www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Fully transitive const is not necessary

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

Apr 02 2008