[Mono-bugs] [Bug 23932] Changed - integer literals for "small" integer types (byte)

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
7 May 2002 19:52:52 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by martin@gnome.org.

http://bugzilla.ximian.com/show_bug.cgi?id=23932

--- shadow/23932	Tue May  7 01:31:04 2002
+++ shadow/23932.tmp.25641	Tue May  7 15:52:52 2002
@@ -50,6 +50,23 @@
 The C-Sharp spec. says (pg. 72):
 The type of an integer literal is determined as follows:
 * If the literal has no suffix, it has the first of these types in
 which its value can be represented: int, uint, long, ulong.
 
 
+
+------- Additional Comments From martin@gnome.org  2002-05-07 15:52 -------
+Well, IMHO this is wrong in this particular case here.You don't want 
+to determine the type based on the literal's value as if it was an 
+assignment. This is the _declaration_ of a constant, so you already 
+know which type the literal must have (and then check to make sure 
+that the literal's value actually fits into that type).
+
+So if you have
+
+	const long a = 5;
+
+this needs to be a long (and not a short because the number 5 fits 
+into a short).
+
+
+