[Mono-list] const weirdness

Ravi Pratap M ravi@ximian.com
07 Apr 2002 17:15:36 -0500


Hi there,


On Sun, 2002-04-07 at 03:10, Jonathan Stowe wrote:
> This fails to compile as it should:
> 
> class Values
> {
>     static void Main()
>     {
>         const int myInt  = 7;
>         myInt = 5;
>     }
> 
> }

	Hmm, IIRC, this case is handled and even reported as an error but looks
like there is some other problem.


> (process:12689): ** WARNING **: unhandled exception
> System.FormatException: "The specified format is invalid"
> in System.IntegerFormatter:NumberToString ()
> in System.Int32:ToString ()
> in System.String:Format ()
> in System.String:Format ()
> in Mono.CSharp.Report:Error ()
> in Mono.CSharp.Assign:DoResolve ()
> in Mono.CSharp.Expression:Resolve ()
> in Mono.CSharp.StatementExpression:Emit ()
> in Mono.CSharp.Block:Emit ()
> in Mono.CSharp.EmitContext:EmitTopBlock ()
> in Mono.CSharp.Method:Emit ()
> in Mono.CSharp.TypeContainer:Emit ()
> in Mono.CSharp.RootContext:EmitCode ()
> in Mono.CSharp.Driver:MainDriver ()
> in Mono.CSharp.Driver:Main ()

	Aah! I get it - the problem here is in the implementation of
System.String.Format in our corlib.dll and looks like _that_ needs a
fix, not mcs :-)


	If the error is reported fine in Windows, then that certainly is the
problem.


	Regards,

		Ravi


-- 
"If you're smart, you'll be humble. There always is somebody
who hasn't read a book and knows twice as much as you do."

              -- David Duchovny in Readers' Digest

	Ravi Pratap M                    <ravi@ximian.com>
                        <http://primates.ximian.com/~ravi>