[m-dev.] for review: document c_code & static vars

Christopher Rodd SPEIRS crs at students.cs.mu.oz.au
Fri Jan 2 21:30:17 AEDT 1998


> 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.
>  

Is this still true if `pragma no_inline' is declared on the C code
fragment?   If it isn't true, then shouldnt we document that so that
people can use static variables if required? 

Chris



More information about the developers mailing list