DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Complying with standard C

Integral constants

As with expressions, the rules for the types of certain integral constants have changed. Previously, an unsuffixed decimal constant had type int only if its value fit in an int and an unsuffixed octal or hexadecimal constant had type int only if its value fit in an unsigned int. Otherwise, an integral constant had type long. (At times the value did not fit in the resulting type!) In ANSI C, the constant type is the first type encountered in the list below that corresponds to the value:


unsuffixed decimal:
int, long, unsigned long

unsuffixed octal or hexadecimal:
int, unsigned int, long, unsigned long

U suffixed:
unsigned int, unsigned long

L suffixed:
long, unsigned long

UL suffixed:
unsigned long
The old integral constant typing rules are used only in the transition mode; the ANSI and conforming modes use the new rules.
Next topic: Third example: integral constants
Previous topic: Second example: result is the same

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005