for review: document c_code & static vars

Fergus Henderson fjh at cs.mu.oz.au
Thu Jan 1 19:25:05 AEDT 1998


Hi,

Oliver, can you please review this?

doc/reference_manual.texi:
	Document restrictions on the use of static variables
	in `pragma c_code' declarations.

Index: reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.80
diff -u -u -r1.80 reference_manual.texi
--- reference_manual.texi	1997/12/09 04:02:17	1.80
+++ reference_manual.texi	1998/01/01 08:22:27
@@ -2769,6 +2769,11 @@
 The C code fragment may refer to the specified variables
 (@var{Var1}, @var{Var2}, @dots{}, and @var{Var})
 directly by name.
+The C code fragment may declare local variables, but it should
+not declare static variables, because the Mercury implementation
+may duplicate the C code fragment for each call, which would result
+in the program having multiple instances of the static variable,
+rather than a single shared instance.
 
 If there is a @code{pragma c_code} declaration for a mode of a predicate
 or function, then that mode of the predicate may not have determinism
-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list