[Mono-devel-list] Warning CS0162?
michi at zeroc.com
Thu May 13 08:18:39 EDT 2004
> Code is considered unreachable if (surprise) there's no way for the code
> to be executed at runtime. For example:
> void Cs0162 ()
> Console.WriteLine ("Hello, World!");
> Console.WriteLine ("This generates CS0162");
> Obviously the second Console.WriteLine won't ever be executed, due to
> the `return' statement on the previous line. This is the simplest
> example, but other situations can generate the warning.
Right. I figured that it was something along those lines.
> > Any way to get rid of the warning?
> Fix the code so that the unreachable code isn't present.
:-) Right :-)
Except that I don't get a source file name or a line number. There are
something like 100 source files in the DLL, some of them quite large,
so it isn't trivial to work out what causes the warning.
> Alternatively, if you *know* that the code *is* reachable and the
> warning is generated erroneously, it could be an mcs bug; please file it
> in bugzilla.
Well, not knowing where the warning is generated means that I can't really
assert that just now. But I *do* know that the same code compiles without
any warnings with Visual Studio .NET, so it may well be a compiler error.
Any suggestions for how to convince mcs to give me a more precise
Michi Henning Ph: +61 4 1118-2700
ZeroC, Inc. http://www.zeroc.com
More information about the Mono-devel-list