Fully transitive const is not necessary

Jason House jason.james.house at gmail.com
Wed Apr 2 05:01:01 PDT 2008


Just like the main thread, my question was about transitive const and its support for multithreading. If transitive const only supports it with pure then the OP is correct...

Janice Caron Wrote:

> On 02/04/2008, Janice Caron <caron800 at googlemail.com> wrote:
> > Global variables will /not/ be reachable from a pure function. Example:
> >
> >     int g;
> >
> >     pure int f()
> >     {
> >         return g; /*ERROR*/
> >     }
> >
> >  The above will not compile, because global variables won't be
> >  available to pure functions.
> 
> However, I suspect that the following will be OK.
> 
>     enum g = 42;
> 
>     pure int f()
>     {
>         return g;
>     }
> 
> I'm only guessing here - I don't have any inside knowledge. But it
> seems reasonable to me that global compile-time constants declared
> outside the function ought to be available inside it. I guess we'll
> just have to wait and see.
> 
> But global variables - no.




More information about the Digitalmars-d mailing list