the standard rules for assigning types to integer constants inC

Joseph S. Myers jsm28@cam.ac.uk
Wed Aug 22 10:37:00 GMT 2001


On Tue, 21 Aug 2001, Zack Weinberg wrote:

> 1: Were these rules different in C89?  If so, what were they?

They were different in C89:

	The type of an integer constant is the first of the corresponding 
	list in which its value can be represented.  Unsuffixed decimal: 
	int, long int, unsigned long int; unsuffixed octal or hexadecimal: 
	int, unsigned int, long int, unsigned long int; suffixed by the 
	letter u or U: unsigned int, unsigned long int; suffixed by the 
	letter l or L: long int, unsigned long int; suffixed by both the 
	letters u or U and l or L: unsigned long int.

> 2: What, if anything, should we do about this?

Implement the rules conditional on flag_isoc99 (making sure that something
appropriate and consistent with ISO 14882 is done for C++) and change
"integer constant type rules" in c99status.html from "Missing" to "Done".
Work out what -Wtraditional ought to do in C99 mode if the C99 type is the
same as the traditional type but different from the C89 type.  No-one
answered my question <URL: http://gcc.gnu.org/ml/gcc/2000-09/msg00417.html >
about this, so I left off implementing this feature.

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc mailing list