4.1.3 Implementation-defined items

This section covers implementation-defined items given by the ANSI C standards.

(1)

Data types and sizes

See "4.1.6 Internal representation and value area of data".

(2)

Translation stages

The ANSI C standard specifies eight translation phases that indicate the precedence among the syntax rules of translation. Each sequence of non-empty white-space characters other than new-line, which is described as implementation-defined in phase 3 (decomposing the source file into preprocessing tokens and white-space characters), is retained rather than being replaced by one space character.

(3)

Diagnostic messages

When syntax rule violation or restriction violation occurs on a translation unit, the compiler outputs as error message containing source file name and (when it can be determined) the number of line containing the error. These error messages are classified: "Warning", "Fatal error", "Error" and "other" messages. For output formats of messages, see the "10.2 Message Formats".

(4)

Program startup processing

The name, type, and arguments of a function that is called when starting program processing are not stipulated.

Therefore, it is dependent on the user-own coding and target system.

(5)

Program execution

The configuration of the interactive unit is not stipulated.

Therefore, it is dependent on the user-own coding and target system.

(6)

Character set

The values of elements of the source code and execution character set are ASCII codes, EUC, SJIS, UTF-8, big5, and gb2312.

Japanese and Chinese characters are supported in comments and character strings.

(7)

Shift states used in encoding of multi-byte characters

No shift state is supported.

(8)

Significance of character display

The values of expanded notation are stipulated as follows.

Table 4.1

Expanded Notation and Meaning

Expanded Notation

Value (ASCII)

Meaning

\a

07

Alert (Warning tone)

\b

08

Backspace

\f

0C

Form feed (New Page)

\n

0A

New line (Line feed)

\r

0D

Carriage return (Restore)

\t

09

Horizontal tab

\v

0B

Vertical tab

(9)

Translation limit

There are limits on translation as shown below. In addition to the absolute quantitative limits of the compiler, there are limits depending on the memory of the host machine on which the compiler is running.

-

The maximum number of pointers, arrays, function declarators (and the combinations of any of them) that qualify an arithmetic, structure, union, or imcomplete type in one declaration is 128.

-

The maximum number of case values in a switch statement is 2147483647.

(10)

Quantitative limit

(a)

The limit values of the general integer types (limits.h file)

The limits.h file specifies the limit values of the values that can be expressed as general integer types (char type, signed/unsigned integer type, and enumerate type).

Because multi-byte characters are not supported, MB_LEN_MAX does not have a corresponding limit. Consequently, it is only defined with MB_LEN_MAX as 1.

The limit values defined by the limits.h file are as follows.

Table 4.2

Limit Values of General Integer Type (limits.h File)

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

-128

Minimum value of char

CHAR_MAX

+127

Maximum value of 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

-2147483648

Minimum value of int

INT_MAX

+2147483647

Maximum value of int

UINT_MAX

+4294967295

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

LLONG_MAX

+9223372036854775807

Maximum value of long long int

ULLONG_MAX

+18446744073709551615

Maximum value of unsigned long long int

(b)

The limit values of the floating-point type (float.h file)

The limit values related to characteristics of the floating-point type are defined in float.h file.

The limit values defined by the float.h file are as follows.

Table 4.3

Definition of Limit Values of Floating-point Type (float.h File)

Name

Value

Meaning

FLT_ROUNDS

1 -Xround=nearest

0 -Xround=zero

Rounding mode for floating-point addition.

1: Rounded to nearest

0: Rounded to zero

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

LDBL_MANT_DIG

+53

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

LDBL_DIG

+15

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

LDBL_MIN_EXP

-1021

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

LDBL_MIN_10_EXP

-307

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

LDBL_MAX_EXP

+1024

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

LDBL_MAX_10_EXP

+308

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

LDBL_MAX

1.7976931348623158E+308

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

LDBL_EPSILON

2.2204460492503131E-016

FLT_MIN

1.17549435E - 38F

Minimum value of normalized positive floating-point number

bemin - 1

DBL_MIN

2.2250738585072014E-308

LDBL_MIN

2.2250738585072014E-308

(c)

The limit values of the floating-point type (half.h file) [V1.05.00 or later]

The limit values related to characteristics of the floating-point type are defined in half.h file.

The limit values defined by the half.h file are as follows.

Table 4.4

Definition of Limit Values of Floating-point Type (half.h File)

Name

Value

Meaning

HALF_MANT_DIG

+11

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

HALF_DIG

+2

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

HALF_MIN_EXP

-13

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.

HALF_MIN_10_EXP

-4

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.

HALF_MAX_EXP

+16

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.

HALF_MAX_10_EXP

+4

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)

HALF_MAX

65504.0F

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

(1 - b-p) * bemax

HALF_EPSILON

0.00097656F

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

HALF_MIN

6.10352E-05F

Minimum value of normalized positive floating-point number

bemin - 1

(11)

Identifier

All identifiers are considered to have meaning. There are no restrictions on identifier length.

Uppercase and lowercase characters are distinguished.

(12)

char type

If a value larger than a char is stored in a char type, then the value is converted to type char.

A char type with no type specifier (signed or unsigned) has the same range of values as that of a signed char.

char    c = '\777';     /*Value of c is -1.*/

(13)

Floating-point constants

The floating-point constants conform to IEEE754Note.

Note

IEEE: Institute of Electrical and Electronics Engineers
IEEE754 is a system for handling floating-point calculations, providing a uniform standard for data formats, numerical ranges, and the like handled.

(14)

Character constants

(a)

Both the character set of the source program and the character set in the execution environment are basically ASCII codes, and correspond to members having the same value.
However, for the character set of the source program, character codes in Japanese can be used (see "(8) Significance of character display").

(b)

An integer character constant having four or less characters has the value of the int type in which the lower byte holds the last character and the upper byte holds the first character. A character constant having five or more characters will lead to an error.

int a1 = 'a';       /* 0x61 */
int a2 = 'ab';      /* 0x6162 */
int a3 = 'abc';     /* 0x616263 */
int a4 = 'abcd';    /* 0x61626364 */
int a5 = 'abcde';   /* Error */

(c)

A character that cannot be expressed by the basic execution environment character set or escape sequence is expressed as follows.

<1>

An octal or hexadecimal escape sequence takes the value indicated by the octal or hexadecimal notation

\777

511

<2>

The simple escape sequence is expressed as follows.

\'

'

\"

"

\?

?

\\

\

<3>

Values of \a, \b, \f, \n, \r, \t, \v are same as the values explained in "(8) Significance of character display".

(d)

Character constants of multi byte characters are not supported.

(15)

Character string

A character string can be described in Japanese and Chinese.

The default character code is Shift JIS.

A character code in input source file can be selected by using the -Xcharacter_set option of the CC-RH.

-Xcharacter_set=[none | euc_jp | sjis | utf8 | big5 | gb2312]

(16)

Locale

No locale is supported.

(17)

Header file name

The method to reflect the string in the two formats (< > and " ") of a header file name on the header file or an external source file name is stipulated in "(34) Loading header file".

(18)

Comment

A comment can be described in Japanese and Chinese. The character code is the same as the character string in "(15) Character string".

(19)

Signed constants and unsigned constants

If the value of a general integer type is converted into a signed integer of a smaller size, the higher bits are truncated and a bit string image is copied.

If an unsigned integer is converted into the corresponding signed integer, the internal representation is not changed.

(20)

Floating-points and general integers

If the value of a general integer type is converted into the value of a floating-point type, and if the value to be converted is within a range that can be expressed but not accurately, the result is rounded to the closest expressible value.

(21)

double type and float type

When casting a double to a float, or a long double to a double or a float, if the typecast value cannot be represented accurately in the available value range, then the result will be rounded to the nearest value that can be represented.

(22)

Signed type in operator in bit units

The characteristics of the shift operator conform to the stipulation in "(28) Shift operator in bit units".

The other operators in bit units for signed type are calculated as unsigned values (as in the bit image).

(23)

Members of structures and unions

If the value of a union member is stored in a different member, the value will be stored in accordance with the alignment condition. As a result, when a union member is accessed using a member of a different type, the internal representation of the data will be of the type of the access.

(24)

sizeof operator

The value resulting from the "sizeof" operator conforms to the stipulation related to the bytes in an object in "(1) Data types and sizes".

For the number of bytes in a structure and union, it is byte including padding area.

(25)

Cast operator

When a pointer is converted into a general integer type, the required size of the variable is the same as the size of the unsigned long type. The bit string is saved as is as the conversion result.

Also, although it is possible to typecast an arbitrary integer to a pointer, after the integer is typecast to a pointer, the integer's bit pattern is retained unchanged.

(26)

Division/remainder operator

The result of the division operator ("/") when the operands are negative and do not divide perfectly with integer division, is as follows: If either the divisor or the dividend is negative, the result is the smallest integer greater than the algebraic quotient.

If both the divisor and the dividend are negative, the result is the largest integer less than the algebraic quotient.

If the operand is negative, the result of the "%" operator takes the sign of the first operand in the expression.

(27)

Addition and subtraction operators

If subtraction is done between two pointers indicating elements of the same array, the type of the result is the int type.

(28)

Shift operator in bit units

If E1 of "E1 >> E2" is of signed type and takes a negative value, an arithmetic shift is executed.

(29)

Storage area class specifier

Optimize for the fastest possible access, regardless of whether there is a storage-class area specifier "register" declaration.

(30)

Structure and union specifier

(a)

A simple int type bit field without signed or unsigned appended is treated as a signed field, and the most significant bit is treated as the sign bit.

(b)

To retain a bit field, a storage area unit to which any address with sufficient size can be assigned can be allocated. If there is insufficient area, however, the bit field that does not match is packed into to the next unit according to the alignment condition of the type of the field.

The default allocation order of the bit field in a unit is from lower to higher.

This order can be changed through the -Xbit_order option or the #pragma bit_order directive.

(c)

Each member of the non-bit field of one structure or union is aligned at a boundary as follows:

char, unsigned char type, and its array

Byte boundary

short, unsigned short type, and its array

2-byte boundary

Others (including pointer)

4-byte boundary

 

If packing is used, however, the boundaries of all members will be the byte boundary.

(31)

Enumerate type specifier

The type of an enumeration specifier is signed int.

However, when the -Xenum_type=auto option is specified, each enumerated type is treated as the smallest integer type capable of expressing all the enumerators in that type.

(32)

Type qualifier

The configuration of access to data having a type qualified to be "volatile" is dependent upon the address (I/O port, etc.) to which the data is mapped. If packing is used, however, the boundaries of all members will be the byte boundary.

(33)

Condition embedding

(a)

The value for the constant specified for condition embedding and the value of the character constant appearing in the other expressions are equal.

(b)

A single-character character constant cannot have a negative value.

(34)

Loading header file

(a)

A preprocessing directive in the form of "#include <character string>"

A preprocessing directive in the form of "#include <character string>" searches for a header file from the folder specified by the -I option if "character string" does not begin with "\"Note, and then searches standard include file folder (..\inc folder with a relative path from the bin folder where the ccrh is placed).

If a header file uniformly identified is searched with a character string specified between delimiters "<" and ">", the whole contents of the header file are replaced.

Note

"/" are regarded as the delimiters of a folder.

Example

#include    <header.h>

 

The search order is as follows.

-

Folder specified by -I

-

Standard include file folder

(b)

A preprocessing directive in the form of "#include "character string""

A preprocessing directive in the form of "#include "character string"" searches for a header file from the folder where the source file exists, then searches specified folder (-I option) and then searches standard include file folder (..\inc folder with a relative path from the bin folder where the ccrh is placed).

If a header file uniformly identified is searched with a character string specified between delimiters " " " and " " ", the whole contents of the header file are replaced.

Example

#include    "header.h"

 

The search order is as follows.

-

Folder where source file exists

-

Folder specified by -I

-

Standard include file folder

(c)

The format of "#include preprocessing character phrase string"

The format of "#include preprocessing character phrase string" is treated as the preprocessing character phrase of single header file only if the preprocessing character phrase string is a macro that is replaced to the form of <character string> or "character string".

(d)

A preprocessing directive in the form of "#include <character string>"

Between a string delimited (finally) and a header file name, the length of the alphabetic characters in the strings is identified,

And the file name length valid in the compiler operating environment is valid.

 

The folder that searches a file conforms to the above stipulation.

(35)

#pragma directive

The CC-RH can specify the following #pragma directives.

(a)

Data or program memory allocation

#pragma section section-type ["section-name"]

Allocates variables to an arbitrary section.

For details about the allocation method, see "4.2.4.1 Allocation of data and program to section".

(b)

Describing assembler instruction

#pragma inline_asm

Assembler directives can be described in a C source program.

For the details of description, see "4.2.4.2 Describing assembler instruction".

(c)

Inline expansion specification

#pragma inline [(]function-name[, function-name ...][)]
#pragma noinline [(]function-name[, function-name ...][)]

A function that is expanded inline can be specified.

For the details of expansion specification, see "4.2.4.3 Inline expansion".

(d)

Interrupt/exception handler specification

#pragma interrupt interrupt-request-name function-name [allocation-method]  [Option [Option]...]

Interrupt/Exception handlers are described in C language.

For the details of description, see "(3) Describing interrupt/exception handler".

(e)

Interrupt disable function specification

#pragma block_interrupt [(]function-name[)]

Interrupts are disabled for the entire function.

For details of description, see "(2) Disabling interrupts in entire function".

(f)

Structure type packing specification

#pragma pack [(][1|2|4][)]

Specifies the packing of a structure type. The packing value, which is an alignment value of the member, is specified as the numeric value. A value of 1, 2, 4 can be specified. When the numeric value is not specified, it is by default alignment.

For details of description, see "4.2.4.8 Structure type packing".

(g)

Specifying bit field assignment

#pragma bit_order [{left|right}]

This specifies a change to the order of the bit field.

For details of description, see "4.2.4.9 Bit field assignment".

(h)

Core number specification (for a multi-core device)

#pragma pmodule pm-specification

A function to which a core number is to be assigned can be specified.

For details of description, see "4.2.4.10 Core number specification (for a multi-core device)".

(i)

Specifying alignment value for branch destination addresses

#pragma align4 [(]function-name[(spec)][)]

This specifies the alignment value for branch destination addresses.

For details on specifying the alignment value for branch destination addresses, see "4.2.4.11 Specifying alignment value for branch destination addresses".

(j)

Specifying function to generate code for detection of stack smashing [Professional Edition only]

#pragma stack_protector [(]function-name[(num=value)][)]
#pragma no_stack_protector [(]function-name[)]

This specifies a function for generating a code for detection of stack smashing.

For details on how to write the code, see "4.2.4.12 Detection of stack smashing [Professional Edition only]".

(36)

Predefined macro names

All the following macro names are supported.

Table 4.5

List of Supported Macros

Macro Name

Definition

__LINE__

Line number of source line at that point (decimal).

__FILE__

Name of source file (character string constant).

__DATE__

Date of translating source file (character string constant in the form of "Mmm dd yyyy"). Here, the name of the month is the same as that generated by the asctime function stipulated by the ANSI C standard (three alphabetic characters with only the first character being a capital letter). The first character of dd is blank if its value is less than 10.Note 1

__TIME__

Translation time of source file (character string constant having format "hh:mm:ss" similar to the time created by the asctime function).Note 1

__STDC__

Decimal constant 1 (defined when the -Xansi option is specified).Note 2

__RENESAS__

This value is not set.

__RENESAS_VERSION__

If the version is V.XX.YY.ZZ, this will be 0xXXYYZZ00.

Example) V.1.00.00 -> -D__RENESAS_VERSION__=0x01000000

__CCRH__

This value is not set .

__CCRH

This value is not set.

__RH850__

This value is not set.

__RH850

This value is not set.

__v850e3v5__

This value is not set (defined when v850e3v5 or rh850 is specified by the -Xcommon option is specified).

__v850e3v5

This value is not set (defined when v850e3v5 or rh850 is specified by the -Xcommon option is specified).

__DBL8

Supported when -Xdbl_size=8 is specified or -Xdbl_size is not specified.

This value is not set.

__DBL4

Supported only when -Xdbl_size=4 is specified.

This value is not set.

__DOUBLE_IS_64BITS__

Supported when -Xdbl_size=8 is specified or -Xdbl_size is not specified.

This value is not set.

__DOUBLE_IS_32BITS__

Supported only when -Xdbl_size=4 is specified.

This value is not set.

__RON

Supported only when -Xround=nearest is specified.

This value is not set.

__ROZ

Supported only when -Xround=zero is specified.

This value is not set.

__BITLEFT

This value is not set (defined when left is specified by the -Xbit_order option).

__BITRIGHT

This value is not set (defined when right is specified by the -Xbit_order option).

__AUTO_ENUM

This value is not set (defined when auto is specified by the -Xenum_type option).

__FPU

This value is not set (defined when fpu is specified by the -Xfloat option).

__CHAR_SIGNED__

This value is not set..

Register mode macro

Macro defined with register mode is as follows.

32 register mode: __reg32__

22 register mode: __reg22__

Universal register mode: __reg_common__

_LIT

This value is not set.

__MULTI_LEVEL__

level value designated in Xmulti_level = level

Note 1.

The date and time of translation can be obtained in any case; the __DATE__ and __TIME__ macro values are always defined.

Note 2.

For the processing to be performed when the -Xansi option is specified, see "4.1.5 Option to process in strict accordance with ANSI standard".

(37)

NULL macro

The NULL macro is defined as follows.

#define NULL ((void *) 0)

(38)

Standard library functions

The following shows the implementation-defined items regarding standard library functions.

The sets of characters tested for by the isalnum, isalpha, iscntrl, islower, isprint, and isupper functions

unsigned char type (0 to 255) and EOF (-1).

The values returned by the mathematics functions on domain errors

Refer to the description of each function in "7.1 Supplied Libraries".

Whether the mathematics functions set the integer expression errno to the value of the macro ERANGE on underflow range errors

Refer to the description of each function in "7.1 Supplied Libraries".

Whether a domain error occurs or zero is returned when the fmod function has a second argument of zero

Refer to the description of the fmod function in "7.4.10 Mathematical functions".

The set of signals for the signal function

The signal function is not supported.

The semantics for each signal recognized by the signal function

The signal function is not supported.

The default handling and the handling at program startup for each signal recognized by the signal function

The signal function is not supported.

If the equivalent of signal(sig, SIG_DFL); is not executed prior to the call of a signal handler, the blocking of the signal that is performed

The signal function is not supported.

Whether the default handling is reset if the SIGILL signal is received by a handler specified to the signal function

The signal function is not supported.

Whether the last line of a text stream requires a terminating new-line character

A new-line character is not required.

Whether space characters that are written out to a text stream immediately before a new-line character appear when read in

The space characters appear.

The number of null characters that may be appended to data written to a binary stream

No NULL characters are allowed.

Whether the file position indicator of an append mode stream is initially positioned at the beginning or end of the file

The file manipulation functions are not supported.

Whether a write on a text stream causes the associated file to be truncated beyond that point

The file manipulation functions are not supported.

The characteristics of file buffering

The file manipulation functions are not supported.

Whether a zero-length file actually exists

The file manipulation functions are not supported.

The rules for composing valid file names

The file manipulation functions are not supported.

Whether the same file can be open multiple times

The file manipulation functions are not supported.

The effect of the remove function on an open file

The remove function is not supported.

The effect if a file with the new name exists prior to a call to the rename function

The rename function is not supported.

The output for %p conversion in the fprintf function

Refer to (5) type specification character in the description of the sprintf function in "7.4.7 Standard I/O functions".

The input for %p conversion in the fscanf function

Refer to (4) type specification character in the description of the sscanf function in "7.4.7 Standard I/O functions".

The interpretation of a - character that is neither the first nor the last character in the scan list for %[ conversion in the fscanf function

Refer to (4) type specification character in the description of the sscanf function in "7.4.7 Standard I/O functions".

The value to which the macro errno is set by the fgetpos or ftell function on failure

The fgetpos and ftell functions are not supported.

The messages generated by the perror function

Refer to the description of perror in "7.4.7 Standard I/O functions".

The behavior of the calloc, malloc, or realloc function if the size requested is zero

The requested size is assumed to be 8.

The behavior of the abort function with regard to open and temporary files

The file manipulation functions are not supported.

The status returned by the exit function if the value of the argument is other than zero, EXIT_SUCCESS, or EXIT_FAILURE

The exit function is not supported.

The set of environment names and the method for altering the environment list used by the getenv function

The getenv function is not supported.

The contents and mode of execution of the string by the system function

The system function is not supported.

The contents of the error message strings returned by the strerror function

Refer to the description of the strerror function in "7.4.3 Character string functions".

The local time zone and Daylight Saving Time

time.h is not supported.

The era for the clock function

No functions for handling time are supported.