[Mono-list] Uninitialized variable not found by mcs
Dan Lewis
dlewis@gmx.co.uk
10 May 2002 16:54:15 +0100
On Fri, 2002-05-10 at 11:31, Detlev Offenbach wrote:
> Hello,
>
> I am starting to learn C# using mono. The attached example taken from
> "Programming C#" does not produce a compiler errormessage saying that the
> variable myInt is used uninitialized. It compiles cleanly instead (used
> mcs v0.11). Furthermore the uninitialized variable was not implicitly
> initialized to 0 (as good C and C++ compilers do). I don't know, if this
> is in error as well. The output from the run was
>
> Uninitialized, myInt: -1073746096
> After assignment, myInt: 5
Paolo added the zero-initialize bit to the reflection library today, so
the runtime will now print 0 as the "uninitialized" value of myInt. MCS
still needs to catch the error at compile time though.
Dan.