8.2 ANSI-Compliance
The latest publically available version of the standard ISO/IEC
9899 - Programming languages - C should be available at: http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899.
Deviations from the compliance:
- functions are not reentrant unless explicitly declared
as such or the --stack-auto command
line option is specified.
- structures and unions cannot be assigned
values directly, cannot be passed as function parameters or assigned
to each other and cannot be a return value from
a function, e.g.:
struct s { ... };
struct s s1, s2;
foo()
{
...
s1 = s2 ; /* is invalid in SDCC although allowed
in ANSI */
...
}
struct s foo1 (struct
s parms) /* invalid in SDCC although allowed in ANSI */
{
struct s rets;
...
return rets; /* is invalid in SDCC although allowed
in ANSI */
}
- initialization of structure arrays must be fully braced.
struct s { char x } a[] = {1, 2}; /* invalid
in SDCC */
struct s { char x } a[] = {{1}, {2}}; /* OK */
- 'long long' (64 bit integers)
not supported.
- 'double' precision floating point not
supported.
- Old K&R style function declarations are NOT allowed.
foo(i,j) /* this old style of function declarations */
int i,j; /* is valid in ANSI but not valid in SDCC */
{
...
}
- Most enhancements in C99 are not supported, e.g.:
for (int i=0; i<10; i++) /* is
invalid in SDCC although allowed in C99 */
- But some have been added recently in SDCC 2.7.0. They must be considered
alpha quality however.
inline int
increment (int a) { return a+1; } /* inlines the increment without
function call overhead */
int * restrict
p; /* accepted but ignored */
- Certain words that are valid identifiers in the standard may be reserved
words in SDCC unless the --std-c89
or --std-c99 command line options are used.
These may include (depending on the selected processor): 'at', 'banked',
'bit', 'code', 'critical', 'data', 'eeprom', 'far', 'flash', 'idata',
'interrupt', 'near', 'nonbanked', 'pdata', 'reentrant', 'sbit', 'sfr',
'shadowregs', 'sram', 'using', 'wparam', 'xdata', '_overlay', '_asm',
'_endasm', and '_naked'. Compliant equivalents of these keywords
are always available in a form that begin with two underscores,
f.e. '__data' instead of 'data'.
Build Daemon user
2008-01-18