[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Character Constants as Integer Values

(K&R, §A2.5.2) The C compiler lets you use character string literals that contain 2 to 4 characters to denote a 32-bit or 64-bit integer values. Here are some examples:

Integer values as character string constants:

Character constant
Equivalent hexadecimal integer value
'ABCDEFGH'  
0x4142434445464748 (64-bit value)  
'ABCDE'  
0x0000000041424344 (64-bit value)  
'ABCD'  
0x41424344 (32-bit value)  
'ABC'  
0x00414243 (32-bit value)  
'AB'  
0x00004142 (32-bit value)  

This extension cannot be turned off. There is no corresponding pragma or setting in the C/C++ Language Panel.


NOTE

This feature is different from using multibyte character sets, where a single character is represented by a data type larger than 1 byte.

See "Multibyte Strings and Comments" for a discussion of a different extension relating to using character sets with more than 256 characters (such as Kanji).


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000