[m-dev.] diff: pragma c_code fix

Peter Ross peter.ross at miscrit.be
Fri Nov 10 22:44:32 AEDT 2000


On Fri, Nov 10, 2000 at 10:27:03PM +1100, Fergus Henderson wrote:
> On 10-Nov-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> > In that case we should document that pragma c_code is not allowed to
> > contain a static global variable.
> 
> The documentation could certainly clarify that issue.  But what you suggest
> would not be correct.  E.g. the following is (and should be) allowed:
> 
> 	:- pragma c_header_code("
> 		int get_foo(void);
> 		void set_foo(int);
> 	").
> 	:- pragma c_code("
> 
> 		static int foo;
> 
> 		int get_foo(void) {
> 			return foo;
> 		}
> 
> 		void set_foo(int val) {
> 			foo = val;
> 		}
> 
> 	").
> 
The documentation should reflect the above then.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list