[Mono-devel-list] string in case statement cannot > 64 chars
Ben Maurer
05mauben at hawken.edu
Wed Feb 18 08:07:14 EST 2004
Hello,
I actually took a look at this last night. It turns out that there is a
runtime bug. Basically, what MCS emits is that it calls
String::IsInterned on the string. It then does a pointer compare on the
constant versions of the string. This allows you to avoid a high number
of char based compares.
For some reason, the 64 char string is not interned as it should be.
I isolated the problem to simple function calls. Hopefully, the runtime
people can get this solved.
Thanks for the report, this is a pretty obscure issue. Very good catch.
-- Ben
>>> "Namit Dhameja" <ndhameja at panaceasoftware.com> 02/17/04 22:01 PM >>>
Hi,
I have submitted a bug against the compiler
http://bugzilla.ximian.com/show_bug.cgi?id=54473 about the string
problem as I am not sure how to classify this bug.
-Best Regards,
Namit.
----- Original Message -----
From: Namit Dhameja
To: Mono-devel-list at lists.ximian.com
Sent: Monday, February 16, 2004 11:53 AM
Subject: [Mono-devel-list] string in case statement cannot > 64 chars
Hi all,
In case statements, the maximum length of the string is 64 bytes. That
is,
<-------------------------------------------------------------->
strName =
"{http://schemas.xmlsoap.org/ws/2003/03/business-process/}partnerLinks";
switch (strName)
{
case
"{http://schemas.xmlsoap.org/ws/2003/03/business-process/}partnerLinks":
System.Console.WriteLine ("Found it"); break;
default: System.Console.WriteLine ("Not Found it"); break;
}
<-------------------------------------------------------------------------------->
This code will print "Not Found it".
On .Net the above code works just fine. I am not aware of the maximum
string
length possible under .Net. If 64 characters is indeed the
specification and
not a bug than perhaps the compiler should issue some sort of warning
about it.
Maybe it would be a better idea to make the string length the same as
microsoft .Net.
-Best Regards,
Namit.
More information about the Mono-devel-list
mailing list