beautypg.com

Deviations from ansi c – Zilog EZ80F916 User Manual

Page 185

background image

UM014423-0607

Using the ANSI C-Compiler

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

165

ANSI C features. This subset consists of those basic language features appropriate to
embedded applications. Specifically the list of required header files and associated library
functions is minimal, namely <

float.h

>, <

limits.h

>, <

stdarg.h

>, and

<

stddef.h

>. A freestanding implementation is allowed to additionally support all or

parts of other standard header files but is not required to. The eZ80Acclaim! C-Compiler,
for example, supports a number of additional headers from the standard library, as speci-
fied in “Library Files Not Required for Freestanding Implementation” on page 166.

A “conforming implementation” (that is, compiler) is allowed to provide extensions, as
long as they do not alter the behavior of any program that uses only the standard features
of the language. The ZiLOG eZ80Acclaim! C-Compiler uses this concept to provide lan-
guage extensions that are useful for developing embedded applications and for making
efficient use of the resources of the eZ80Acclaim! CPU. These extensions are described in
“Language Extensions” on page 135.

Deviations from ANSI C

The differences between the ZiLOG eZ80Acclaim! C-Compiler and the freestanding
implementation of ANSI C Standard consist of both extensions to the ANSI standard and
deviations from the behavior described by the standard. The extensions to the ANSI stan-
dard are explained in “Language Extensions” on page 135.

There are a small number of areas in which the eZ80Acclaim! C-Compiler does not
behave as specified by the Standard. These areas are described in the following sections:

“Prototype of Main” on page 165

“Double Treated as Float” on page 166

“Library Files Not Required for Freestanding Implementation” on page 166

Prototype of Main
As per ANSI C, in a freestanding environment, the name and type of the function called at
program startup are implementation defined. Also, the effect of program termination is
implementation defined.

For compatibility with hosted applications, the eZ80Acclaim! C-Compiler uses

main()

as the function called at program startup. Because the eZ80Acclaim! compiler provides a
freestanding 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 as there is no operating system for a value to be returned to and is
also not intended to terminate. If

main()

does terminate, and the standard ZiLOG

eZ80Acclaim! C startup module is in use, control simply goes to the following statement:

jmp $

which is equivalent to

label1:

goto label1;

This manual is related to the following products: