4.1.4 C99 language function

This section describes the C99 language functions supported by the CC-RL.

(1)

Comment by //

Text from two slashes (//) until a newline character is a comment. If there is a backslash character (\) immediately before the newline, then the next line is treated as a continuation of the current comment.

(2)

Concatenating wide string literal

The result of concatenating a character string literal with a wide string literal is a wide string literal.

(3)

_Bool type

_Bool type is supported.

_Bool type is a 1-byte integer type that holds only 0 or 1.

When the -lang=c and -strict_std options are specified, _Bool type is not supported and it generates a compilation error.

(4)

long long int type

long long int type is supported. long long int type is an 8-byte integer type.

Appending "LL" and "ULL" to a constant value is also supported. It is also possible to specify this for bit field types.

When the -lang=c and -strict_std options are specified, the long long int type is not supported and it generates a compilation error.

(5)

Integer promotion

In accordance with support for types _Bool and long long, integer promotion is also in accordance with the C99 specification.

When the -lang=c and -strict_std options are specified, _Bool type and long long type is not supported and integer promotion is in accordance with the C90 specification.

(6)

Aggregate initialization

The initializer for an aggregate or union type object that has automatic storage duration conforms to the C99 specifications.

In the C90 specifications, only a constant expression is allowed for an initializer, but other expressions can be used in CC-RL.

void func(int param) {
        int i = param;              //Allowed both in C90 and C99
        int array[] = { param };    //Not allowed in C90, allowed in C99, and 
                                    //allowed in CC-RL

(7)

Default argument promotions

In accordance with support for types _Bool and long long, default argument promotions is also in accordance with the C99 specification..

-

Functions are called after expanding type _Bool_ to type int (2 bytes).

-

Functions are called with type (unsigned) long long remaining as an 8 bytes value.

-

When the option -dbl_size=4 is used, functions are called with type float remaining 4 bytes.
This is because as a result of this option, even if a float is promoted to a double, the double type will have 4 bytes (same as the float type).

 

A near pointer is converted to a far pointer.

void* conforms to the rules for variable pointers.

(8)

Comma permission behind the last enumerator of a enum definition

When defining an enum type, it is permissible for the last enumerator in the enumeration to be followed by a comma (,).

enum EE {a, b, c,};

 

When the -lang=c and -strict_std options are specified, this comma will generate an error.

(9)

Types of integer constants

In accordance with the addition of type long long, the types of integer constants are as follows.

The type of an integer constant will be the first type in the lists below capable of representing that value.

 

Table 4.4

Types of Integer Constants (If type long long is enabled (when -lang=c is specified and -strict_std is not))

Suffix

Decimal Constant

Binary Constant, Octal Constant, or Hexadecimal Constant

None

int

long int

unsigned long intNote

long long int

unsigned long long int

int

unsigned int

long int

unsigned long int

long long int

unsigned long long int

u or U

unsigned int

unsigned long int

unsigned long long int

unsigned int

unsigned long int

unsigned long long int

l or L

long int

unsigned long intNote

long long int

unsigned long long int

long int

unsigned long int

long long int

unsigned long long int

Both u or U, and l or L

unsigned long int

unsigned long long int

unsigned long int

unsigned long long int

ll or LL

long long int

unsigned long long int

long long int

unsigned long long int

Both u or U, and ll or LL

unsigned long long int

unsigned long long int

Note

Different from C99 specification. This is added to avoid the case where an integer constant represented as 4-byte data in C90 is unexpectedly represented as 8-byte data.

Table 4.5

Types of Integer Constants (If type long long is disabled (when -lang=c and -strict_std are specified))

Suffix

Decimal Constant

Binary Constant, Octal Constant, or Hexadecimal Constant

None

int

long int

unsigned long int

int

unsigned int

long int

unsigned long int

u or U

unsigned int

unsigned long int

unsigned int

unsigned long int

l or L

long int

unsigned long int

long int

unsigned long int

Both u or U, and l or L

unsigned long int

unsigned long int

Table 4.6

Types of Integer Constants (If type long long is enabled (when -lang=c99 is specified))

Suffix

Decimal Constant

Binary Constant, Octal Constant, or Hexadecimal Constant

None

int

long int

long long int

unsigned long long int

int

unsigned int

long int

unsigned long int

long long int

unsigned long long int

u or U

unsigned int

unsigned long int

unsigned long long int

unsigned int

unsigned long int

unsigned long long int

l or L

long int

long long int

unsigned long long int

long int

unsigned long int

long long int

unsigned long long int

Both u or U, and l or L

unsigned long int

unsigned long long int

unsigned long int

unsigned long long int

ll or LL

long long int

unsigned long long int

long long int

unsigned long long int

Both u or U, and ll or LL

unsigned long long int

unsigned long long int

(10)

Addition of standard header

Standard header stdint.h is added, which defines the following types.

Table 4.7

Type Definition Names in stdint.h

Type Name

Actual Type

Remark

int8_t

signed char

 

int16_t

signed short

 

int32_t

signed long

 

int64_t

signed long long

When -strict_std is not used or -lang=c99 is used

uint8_t

unsigned char

 

uint16_t

unsigned short

 

uint32_t

unsigned long

 

uint64_t

unsigned long long

When -strict_std is not used or -lang=c99 is used

int_least8_t

signed char

 

int_least16_t

signed short

 

int_least32_t

signed long

 

int_least64_t

signed long long

When -strict_std is not used or -lang=c99 is used

uint_least8_t

unsigned char

 

uint_least16_t

unsigned short

 

uint_least32_t

unsigned long

 

uint_least64_t

unsigned long long

When -strict_std is not used or -lang=c99 is used

int_fast8_t

signed char

 

int_fast16_t

signed short

 

int_fast32_t

signed long

 

int_fast64_t

signed long long

When -strict_std is not used or -lang=c99 is used

uint_fast8_t

unsigned char

 

uint_fast16_t

unsigned short

 

uint_fast32_t

unsigned long

 

uint_fast64_t

unsigned long long

When -strict_std is not used or -lang=c99 is used

intptr_t

signed long

 

uintptr_t

unsigned long

 

intmax_t

signed long

When -lang=c and -strict_std are used

signed long long

When -strict_std is not used or -lang=c99 is used

uintmax_t

unsigned long

When -lang=c and -strict_std are used

unsigned long long

When -strict_std is not used or -lang=c99 is used

 

stdint.h defines the following macros.

Table 4.8

Macro Definition Names in stdint.h

Macro Name

Value

Remark

INT8_MIN

-128

 

INT16_MIN

-32768

 

INT32_MIN

-2147483648

 

INT64_MIN

-9223372036854775808

When -strict_std is not used or -lang=c99 is used

INT8_MAX

+127

 

INT16_MAX

+32767

 

INT32_MAX

+2147483647

 

INT64_MAX

+9223372036854775807

When -strict_std is not used or -lang=c99 is used

UINT8_MAX

+255

 

UINT16_MAX

+65535

 

UINT32_MAX

+4294967295

 

UINT64_MAX

+18446744073709551615

When -strict_std is not used or -lang=c99 is used

INT_LEAST8_MIN

-128

 

INT_LEAST16_MIN

-32768

 

INT_LEAST32_MIN

-2147483648

 

INT_LEAST64_MIN

-9223372036854775808

When -strict_std is not used or -lang=c99 is used

INT_LEAST8_MAX

+127

 

INT_LEAST16_MAX

+32767

 

INT_LEAST32_MAX

+2147483647

 

INT_LEAST64_MAX

+9223372036854775807

When -strict_std is not used or -lang=c99 is used

UINT_LEAST8_MAX

+255

 

UINT_LEAST16_MAX

+65535

 

UINT_LEAST32_MAX

+4294967295

 

UINT_LEAST64_MAX

+18446744073709551615

When -strict_std is not used or -lang=c99 is used

INT_FAST8_MIN

-128

 

INT_FAST16_MIN

-32768

 

INT_FAST32_MIN

-2147483648

 

INT_FAST64_MIN

-9223372036854775808

When -strict_std is not used or -lang=c99 is used

INT_FAST8_MAX

+127

 

INT_FAST16_MAX

+32767

 

INT_FAST32_MAX

+2147483647

 

INT_FAST64_MAX

+9223372036854775807

When -strict_std is not used or -lang=c99 is used

UINT_FAST8_MAX

+255

 

UINT_FAST16_MAX

+65535

 

UINT_FAST32_MAX

+4294967295

 

UINT_FAST64_MAX

+18446744073709551615

When -strict_std is not used or -lang=c99 is used

INTPTR_MIN

-2147483648

 

INTPTR_MAX

+2147483647

 

UINTPTR_MAX

+4294967295

 

INTMAX_MIN

-2147483648

When -lang=c and -strict_std are used

-9223372036854775808

When -strict_std is not used or -lang=c99 is used

INTMAX_MAX

+2147483647

When -lang=c and -strict_std are used

+9223372036854775807

When -strict_std is not used or -lang=c99 is used

UINTMAX_MAX

+4294967295

When -lang=c and -strict_std are used

+18446744073709551615

When -strict_std is not used or -lang=c99 is used

PTRDIFF_MIN

-32768

 

PTRDIFF_MAX

+32767

 

SIZE_MAX

+65535

 

(11)

Variadic macro

The variadic macro is enabled.

#define pf(form, ...) printf(form, __VA_ARGS__)

 

pf("%s %d\n", "string", 100);

printf("%s %d\n", "string", 100);