Docs: Section on local variables

Stewart Gordon smjg_1998 at yahoo.com
Sat Apr 21 05:03:13 PDT 2012


On 20/04/2012 01:53, Andrej Mitrovic wrote:
> Can I remove this section from the D docs, in functions? :
>
> "
> Local Variables
> 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.

This does seem to be a total contradiction of the principle that's stated elsewhere in the 
D spec that variables are always initialised.

> It is an error to declare a local variable that is never referred to.
> Dead variables, like anachronistic dead code, are just a source of
> confusion for maintenance programmers.
> "
<snip>

Why do you want to be able to declare local variables and then never use them?

Stewart.


More information about the Digitalmars-d-learn mailing list