Fully transitive const is not necessary
Walter Bright
newshound1 at digitalmars.com
Wed Apr 2 15:20:05 PDT 2008
Janice Caron wrote:
> 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.
That's right, unless they are invariant globals.
More information about the Digitalmars-d
mailing list