[m-dev.] diff: pragma c_code fix

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 10 22:27:03 AEDT 2000


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;
		}

	").

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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