www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler allows unused locals

reply "Lynn Allan" <l_d_allan adelphia.net> writes:
<alert comment="newbie">

On the documentation page:
http://www.digitalmars.com/d/overview.html

Compile Time Checks
* Stronger type checking
* Explicit initialization required
* Unused local variables not allowed
* No empty ; for loop bodies
* Assignments do not yield boolean results
* Deprecating of obsolete API's

As of dmd ver 0.102, it seems like the compiler actually does allow
unused local variables and applies implicit initialization to local
variables.

#void main ()
#{
#  int unused;   // compiler should complain?
#  int result;
#  int uninitialized;  // implicitly initialized to 0
#  result = uninitialized;  // compiler should complain?
#}

</alert>
Oct 14 2004
parent "Walter" <newshound digitalmars.com> writes:
Looks like a bug in the documentation. I'll fix it.
Oct 19 2004