Bugzilla – Bug 314174
We do not do complete folding of string concating
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by bmaurer@users.sf.net 2004-03-22 12:39:25 MST ---- If you compile the following code: using System; class T { static void Main () { string name = "foo"; Console.WriteLine ("Enumerator value for '" + name + "' is too large to " + "fit in its type"); } } the il code is: IL_0000: ldstr "foo" IL_0005: stloc.0 IL_0006: ldstr "Enumerator value for '" IL_000b: ldloc.0 IL_000c: ldstr "' is too large to " IL_0011: ldstr "fit in its type" IL_0016: call string valuetype [mscorlib]'System.String'::'Concat'(string, string, string, string) IL_001b: call void class [mscorlib]'System.Console'::'WriteLine'(string) IL_0020: ret IL_000c: ldstr "' is too large to " IL_0011: ldstr "fit in its type" IL_0016: call string valuetype [mscorlib]'System.String'::'Concat'(string, string, string, string) is redundant, the string should be folded at compile time, so that you have: IL_000c: ldstr "' is too large to fit in its type" and then concat with 3 arguments. ---- Additional Comments From bmaurer@users.sf.net 2004-03-22 22:03:53 MST ---- Not really a dup, but the same patch does both things. *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO55906 *** Unknown operating system unknown. Setting to default OS "Other". This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"