Sun WorkShop Compiler C 5.0 User's Guide

Constants

This section contains information related to constants that is specific to the Sun ANSI/ISO C compiler.

Integral Constants

Decimal, octal, and hexadecimal integral constants can be suffixed to indicate type, as shown in the Table 3-1.

Table 3-1 Data Type Suffixes

Suffix 

Type 

u or U

unsigned

l or L

long

ll or LL

long long [long long and unsigned long long are not available in -Xc mode.]

lu, LU, Lu, lU, ul, uL, Ul, or UL

unsigned long

llu, LLU, LLu, llU, ull, ULL, uLL, Ull

unsigned long long1

When assigning types to unsuffixed constants, the compiler uses the first of this list in which the value can be represented, depending on the size of the constant:

Character Constants

A multiple-character constant that is not an escape sequence has a value derived from the numeric values of each character. For example, the constant '123' has a value of:

Table 3-2 Multiple-character Constant (ANSI/ISO)

0

'3'

'2'

'1'

or 0x333231.

With the -Xs option and in other, non-ANSI/ISO versions of C, the value is:

Table 3-3 Multiple-character Constant (non-ANSI/ISO)

0

'1'

'2'

'3'

or 0x313233.