Error: constant false is not an lvalue

Rainer Deyke rainerd at eldwood.com
Sun Aug 30 12:02:01 PDT 2009


Jarrett Billingsley wrote:
> "It is an error to use a local variable without first assigning it a
> value. The implementation may not always be able to detect these
> cases. Other language compilers sometimes issue a warning for this,
> but since it is always a bug, it should be an error."
> http://www.digitalmars.com/d/1.0/function.html

Then the spec is wrong.  Default initialization removes the need to
explicitly assign a value to a variable in order to initialize it.

The purpose of default initialization is not to find or reduce bugs, but
to reduce the size of legal programs.  For the purpose of reducing bugs,
it would be better to always require explicit initialization.


-- 
Rainer Deyke - rainerd at eldwood.com


More information about the Digitalmars-d-learn mailing list