Deviations from ansi c – Zilog Z8F0130 User Manual
Page 280

Using the ANSI C-Compiler
UM013037-1212
256
Zilog Developer Studio II – Z8 Encore!
User Manual
extensions that are useful for developing embedded applications and for making efficient
use of the resources of the Z8 Encore! CPU. These extensions are described in the
Deviations from ANSI C
The differences between the Zilog Z8 Encore! C-Compiler and the freestanding imple-
mentation of ANSI C Standard consist of both extensions to the ANSI standard and devia-
tions from the behavior described by the standard. The extensions to the ANSI standard
are explained in the
There are a small number of areas in which the Z8 Encore! C-Compiler does not behave as
specified by the standard. These areas are described in the following sections:
•
•
•
•
Const Correctness in the Standard Header Files
•
•
Library Files Not Required for Freestanding Implementation
Prototype of Main
As per ANSI C, in a freestanding environment, the name and type of the function called at
program start-up are implementation defined. Also, the effect of program termination is
implementation defined.
For compatibility with hosted applications, the Z8 Encore! C-Compiler uses
main()
as
the function called at program startup. Because the Z8 Encore! compiler provides a free-
standing execution environment, there are a few differences in the syntax for
main()
. The
most important of these is that, in a typical small embedded application,
main()
never
executes a return because there is no operating system for a value to be returned to and it is
also not intended to terminate. If
main()
does terminate and the standard Zilog Z8
Encore! C start-up module is in use, control simply goes to the following statement:
_exit:
JR _exit
For this reason, in the Z8 Encore! C-Compiler,
main()
must be of type
void
; any
returned value is ignored. Also,
main()
is not passed any arguments. In short, the follow-
ing is the prototype for
main()
:
void main (void);
Unlike the hosted environment in which the closest allowed form for main is as follows:
int main (void);
- Z8F0131 Z8F0230 Z8F0231 Z8F0430 Z8F0431 Z8F043A Z8F0830 Z8F0831 Z8F083A Z8F1232 Z8F1233 Z8F0113 Z8F011A Z8F0123 Z8F012A Z8F0213 Z8F021A Z8F0223 Z8F022A Z8F0411 Z8F0412 Z8F0413 Z8F041A Z8F0421 Z8F0422 Z8F0423 Z8F042A Z8F0811 Z8F0812 Z8F0813 Z8F081A Z8F0821 Z8F0822 Z8F0823 Z8F082A Z8F0880 Z8F1621 Z8F1622 Z8F1680 Z8F1681 Z8F1682 Z8F2421 Z8F2422 Z8F2480 Z8F3221 Z8F3222 Z8F3281 Z8F3282 Z8F4821 Z8F4822 Z8F4823 Z8F6081 Z8F6082 Z8F6421 Z8F6422 Z8F6423 Z8F6481 Z8F6482 Z8FS021A ZMOT1AHH Z8FS040B ZMOT0BHH ZMOT0BSB Z8FMC04 Z8FMC08 Z8FMC16