Everything
4.2.3 C99 language specifications supported in conjunction with C90

CC-RL supports some of the C99-standard specifications even when the C90 standard is selected (with -lang=c).

(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

The type of an integer constant changes due to addition of the long long type. For details, see "(c) Integer constants" in "4.1.3 Internal representation and value area of data".

(10)

Standard header

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

(a)

limits.h

Table 4.11

limits.h

Name

Value

Meaning

CHAR_BIT

+8

The number of bits (= 1 byte) of the minimum object not in bit field

SCHAR_MIN

-128

Minimum value of signed char

SCHAR_MAX

+127

Maximum value of signed char

UCHAR_MAX

+255

Maximum value of unsigned char

CHAR_MIN

0 (-128)

Minimum value of char (The default is the value of unsigned char. When the -signed_char option is specified, it becomes the value of signed char.)

CHAR_MAX

+255 (+127)

Maximum value of char (The default is the value of unsigned char. When the -signed_char option is specified, it becomes the value of signed char.)

SHRT_MIN

-32768

Minimum value of short int

SHRT_MAX

+32767

Maximum value of short int

USHRT_MAX

+65535

Maximum value of unsigned short int

INT_MIN

-32768

Minimum value of int

INT_MAX

+32767

Maximum value of int

UINT_MAX

+65535

Maximum value of unsigned int

LONG_MIN

-2147483648

Minimum value of long int

LONG_MAX

+2147483647

Maximum value of long int

ULONG_MAX

+4294967295

Maximum value of unsigned long int

LLONG_MIN

-9223372036854775807

Minimum value of long long int

(Invalid when using option -lang=c and -strict_std)

LLONG_MAX

+9223372036854775807

Maximum value of long long int

(Invalid when using option -lang=c and -strict_std)

ULLONG_MAX

+18446744073709551615

Maximum value of unsigned long long int

(Invalid when using option -lang=c and -strict_std)

(b)

float.h

The values in parentheses are for the case when the -dbl_size=4 option is used, which specifies sizeof(double) = sizeof(long double) = 4. -dbl_size=4 is the default setting in the CC-RL.

Table 4.12

float.h

Name

Value

Meaning

FLT_ROUNDS

+1

Rounding mode for floating-point addition.

1 for the RL78 family (rounding in the nearest direction).

FLT_EVAL_METHOD

0

Evaluation format of floating-point number

(Invalid when using option -lang=c)

FLT_RADIX

+2

Radix of exponent (b)

FLT_MANT_DIG

+24

Number of numerals (p) with FLT_RADIX of floating- point mantissa as base

DBL_MANT_DIG

+53 (+24)

LDBL_MANT_DIG

+53 (+24)

DECIMAL_DIG

+17 (+9)

Number of digits of a decimal number (q) that can round a floating-point number of p digits using radix b to a decimal number of q digits and then restore the floating-point number of p digits using radix b without any change

(Invalid when using option -lang=c)

FLT_DIG

+6

Number of digits of a decimal number (q) that can round a decimal number of q digits to a floating-point number of p digits of the radix b and then restore the decimal number of q

DBL_DIG

+15 (+6)

LDBL_DIG

+15 (+6)

FLT_MIN_EXP

-125

Minimum negative integer (emin) that is a normalized floating-point number when FLT_RADIX is raised to the power of the value of FLT_RADIX minus 1.

DBL_MIN_EXP

-1021 (-125)

LDBL_MIN_EXP

-1021 (-125)

FLT_MIN_10_EXP

-37

Minimum negative integer log10bemin-1 that falls in the range of a normalized floating-point number when 10 is raised to the power of its value.

DBL_MIN_10_EXP

-307 (-37)

LDBL_MIN_10_EXP

-307 (-37)

FLT_MAX_EXP

+128

Maximum integer (emax) that is a finite floating-point number that can be expressed when FLT_RADIX is raised to the power of its value minus 1.

DBL_MAX_EXP

+1024 (+128)

LDBL_MAX_EXP

+1024 (+128)

FLT_MAX_10_EXP

+38

Maximum integer that falls in the range of a normalized floating-point number when 10 is raised to this power.

log10 ((1 - b-p) * bemax)

DBL_MAX_10_EXP

+308 (+38)

LDBL_MAX_10_EXP

+308 (+38)

FLT_MAX

3.40282347E + 38F

Maximum value of finite floating-point numbers that can be expressed

(1 - b-p) * bemax

DBL_MAX

1.7976931348623158E+308 (3.40282347E+38F)

LDBL_MAX

1.7976931348623158E+308 (3.40282347E+38F)

FLT_EPSILON

1.19209290E - 07F

Difference between 1.0 that can be expressed by specified floating-point number type and the lowest value which is greater than 1.

b1 - p

DBL_EPSILON

2.2204460492503131E-016 (1.19209290E - 07)

LDBL_EPSILON

2.2204460492503131E-016 (1.19209290E - 07F)

FLT_MIN

1.17549435E - 38F

Minimum value of normalized positive floating-point number

bemin - 1

DBL_MIN

2.2250738585072014E-308 (1.17549435E - 38F)

LDBL_MIN

2.2250738585072014E-308 (1.17549435E - 38F)

(c)

stdint.h

Table 4.13

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

 

Table 4.14

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);