Fully transitive const is not necessary
Janice Caron
caron800 at googlemail.com
Wed Apr 2 00:00:28 PDT 2008
On 02/04/2008, Jason House <jason.james.house at gmail.com> wrote:
> And how do global variables fit into that? Technically, they're always
> reachable and never inherit const.
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.
So the answer is, you will still be able to use global variables, but
only in non-pure functions. I've always thought that using global
variables is a very bad idea anyway, and they certainly can cause
problems for multithreading.
More information about the Digitalmars-d
mailing list