Appendix A.6 of the ANSI C standard collects together information about portability issues; section A.6.3 lists those points which must be defined by each implementation. This section corresponds to appendix A.6.3, dealing with the points listed there, under the same headings and in the same order.
where severity is one of:
"source-file", line-number: severity: explanation
main()
is implementation-specific. The generic ARM C library supports the following:
main()
are the words of the command line (not including I/O redirections, covered below), delimited by white space, except where the white space is contained in double quotes. A white space character is any character of which isspace()
is true. A double quote or backslash character (\) inside double quotes must be preceded by a backslash character. An I/O redirection will not be recognised inside double quotes.
runs the program, redirecting stdin to the file infile, stdout to the file outfile, and stderr to the file errfile.
mycopy < infile > outfile 2> errfile
The following shows the allowed redirections:
-------------------------------------------------------- 0< filename |read stdin from filename -------------------------------------------------------- < filename |read stdin from filename -------------------------------------------------------- | -------------------------------------------------------- 1> filename |write stdout to filename -------------------------------------------------------- > filename |write stdout to filename -------------------------------------------------------- | -------------------------------------------------------- 2> filename |write stderr to filename -------------------------------------------------------- 2>&1 |write stderr to same place as stdout -------------------------------------------------------- | -------------------------------------------------------- >& |write both stdout and stderr to filename filename | -------------------------------------------------------- >> |append stdout to filename filename | -------------------------------------------------------- >>& |append both stdout and stderr to filename |filename --------------------------------------------------------
256 characters are significant in identifiers with external linkage. Allowed characters are letters, digits, and underscores.
Case distinctions are significant in identifiers with external linkage.
In pcc mode (-pcc option) and "limited pcc" or "system programming" mode (-fc option), the character '$' is also valid in identifiers.
Other properties of the source character set are host specific, save that the ARM C compiler has no support for multi-byte character sets.
The properties of the execution character set are target specific. In its generic form, the ARM C library supports the ISO 8859-1 (Latin-1) character set, so the following points are expected to hold:
--------------------------------------------------------- Escape |Char value|Description sequence | | --------------------------------------------------------- \a |7 |Attention (bell) --------------------------------------------------------- \b |8 |Backspace --------------------------------------------------------- \f |9 |Form feed --------------------------------------------------------- \n |10 |Newline --------------------------------------------------------- \r |11 |Carriage return --------------------------------------------------------- \t |12 |Tab --------------------------------------------------------- \v |13 |Vertical tab --------------------------------------------------------- \xnn |0xnn |ASCII code in hexadecimal --------------------------------------------------------- \nnn |0nnn |ASCII code in octal ---------------------------------------------------------
div()
.
Note also that there is a #pragma which assigns a file-scope variable to a specified register everywhere within a compilation unit.
The effect of accessing a volatile-qualified short is undefined.
The ANSI standard header files are contained within the compiler itself and may be referred to in the way described in the standard (using, for example, #include <stdio.h>, etc.).
Quoted names for includable source files are supported. The rules for directory searching are given in Included files. The compiler will accept host file names or Unix file names. In the latter case, on non-Unix hosts, the compiler does its best to translate the file name to a local equivalent. See File naming conventions for more details.
The recognized #pragma directives and their meanings are described in Pragma directives.
The date and time of translation are always available, so __DATE__ and __TIME__ always give respectively the date and time.
assert()
function prints the following message and then calls the abort() function:
*** assertion failed: expression, file file-name, line
--------------------------------------------------------- Function |Condition |Return value --------------------------------------------------------- log(x) |x <= 0 |-HUGE_VAL --------------------------------------------------------- log10(x) |x <= 0 |-HUGE_VAL --------------------------------------------------------- sqrt(x) |x < 0 |-HUGE_VAL --------------------------------------------------------- atan2(x,y) |x = y = 0 |-HUGE_VAL --------------------------------------------------------- asin(x) |abs(x) > 1 |-HUGE_VAL --------------------------------------------------------- acos(x) |abs(x) > 1 |-HUGE_VAL ---------------------------------------------------------
Where -HUGE_VAL is written above, a number is returned which is defined in the header math.h. Consult the errno variable for the error number.
The mathematical functions set errno to ERANGE on underflow range errors.
A domain error occurs if the second argument of fmod is zero, and HUGE_VAL is returned.
The set of signals for the generic signal()
function is as follows:
-------------------------------------------------------- SIGABRT |Abort -------------------------------------------------------- SIGFPE |Arithmetic exception -------------------------------------------------------- SIGILL |Illegal instruction -------------------------------------------------------- SIGINT |Attention request from user -------------------------------------------------------- SIGSEGV |Bad memory access -------------------------------------------------------- SIGTERM |Termination request -------------------------------------------------------- SIGSTAK |Stack overflow --------------------------------------------------------
The default handling of all recognised signals is to print a diagnostic message and call exit. This default behaviour applies at program start-up.
When a signal occurs, if func points to a function, the equivalent of signal(sig, SIG_DFL) is first executed.
If the SIGILL signal is received by a handler specified to the signal function, the default handling is reset.
The generic ARM C library also has the following characteristics relating to I/O, (of course, any particular targeting of it may not have):
fprintf()
prints %p arguments in hexadecimal format (lower case) as if a precision of 8 had been specified. If the variant form (%#p) is used, the number is preceded by the character '@'.
fscanf()
treats %p arguments identically to %x arguments.
fscanf()
always treats the character '-' in a %...[...] argument as a literal character.
ftell()
and fgetpos()
set errno to the value of EDOM on failure.
perror()
generates the following messages:
-------------------------------------------------------- Error |Message -------------------------------------------------------- 0 |No error (errno = 0) -------------------------------------------------------- EDOM |EDOM - function argument out of range -------------------------------------------------------- ERANGE |ERANGE - function result not representable -------------------------------------------------------- ESIGNUM |ESIGNUM - illegal signal number to signal() or |raise() -------------------------------------------------------- others |Error code number has no associated message --------------------------------------------------------
calloc()
, malloc()
and realloc()
, if the size of area requested is zero, return NULL.
abort()
closes all open files, and deletes all temporary files.
exit()
is the same value that was passed to it. For definitions of EXIT_SUCCESS and EXIT_FAILURE refer to the header file stdlib.h
strerror()
function are identical to those given by the perror()
function.
remove()
can remove an open file.
rename()
function when the new name already exists.
getenv()
(the default is to return NULL-no value available).
system()
.
clock()
.