Error: constant false is not an lvalue
grauzone
none at example.net
Sun Aug 30 07:53:15 PDT 2009
> I wouldn't be surprised if W himself has forgotten about this rule,
> since other parts of the spec make no mention of it, or seem to depend
> on the default-initialization of variables.
>
> "If the Initializer is void, however, the variable is not initialized.
> If its value is used before it is set, undefined program behavior will
> result."
> http://www.digitalmars.com/d/1.0/declaration.html
And below that, there's even an example with local variables.
I think what you were referring to is an outdated part of the
specification, especially because "= void;" was added only recently.
(Which also shows how worthless the specification is: not only
incomplete, but full or inconsistencies and errors?)
As to whether initializing variables by default or disallowing reading
uninitialized values is better: I think it's very annoying, if the
compiler tries to be smart, but then comes in to your way. Additionally,
the result of the uninitialized value detection might end up being
compiler specific, and that wouldn't be beautiful at all anymore.
Actually, that case is very likely, since Walter would never rigorously
define how exactly it should be done.
More information about the Digitalmars-d-learn
mailing list