ISO/ANSI C

Byte Craft Limited and Standards

Byte Craft Limited is involved in the ongoing specification of C, especially as relates to embedded and self-hosting environments.

Walter Banks, Byte Craft Limited.

From time to time, our customers have asked why Byte Craft has never claimed our compilers to be ISO/ANSI C compliant. Most ISO- and ANSI-C conforming programs will run just fine on our compiler tools. For various reasons, however, we do not conform to all of the ISO/ANSI C requirements. As a matter of policy, we conform to the ISO/ANSI standards as closely as we can, in the context of the application environments.

We are well-versed in the issues surrounding C and standards. Byte Craft Limited is one of Canada's representatives to ISO (through the Standards Council of Canada). We are an active participant in WG-14, which is presently working on a technical refence, "Extensions for the Programming Language C to support Embedded Processors" ISO/IEC WDTR 18037.

The original purpose of the ANSI specification was to establish a narrow definition of the C language, one that could be compiled and run on many different computers and execution environments. It was a grand vision of portability. The ANSI C standard, unlike most standards, does not dictate a minimum level of functionality. Strictly-conforming compilers accept a specific definition of the language.

The ANSI C specifications were first released in 1990, in a document with the formal-sounding name of ANSI X3.159-1989. This standard was also adopted by the International Standards Organization (ISO) as ISO/TEC 9899-1990. Subsequently, the standard was updated, and the latest version is C99, ISO/IEC 9899:1999. There are many ways to get copies of the ISO/ANSI C standard. The current standard (C99) is available from ANSI's website at www.ansi.org. Alternatively, any good computer bookstore should have "The Annotated ANSI C Standard" by Herbert Schildt (Osborne/McGraw Hill ISBN 0-07-881952-0); this publication contains a copy of C89, the standard which became ISO/TEC 9899-1990.

Embedded systems application developers have recognized that freestanding systems have different needs than hosted systems. The group crafting the technical reference ("Extensions for the Programming Language C to support Embedded Processors") have been looking very carefully at the extensions needed by embedded systems, and how these may be applied in the context of the formal C language definition. For instance, there is essentially universal agreement that I/O space has different characteristics from normal address space, even if it is memory mapped. It is reasonable that different parts of memory be handled separately, and the logical direction of this is device driver support for selected RAM memory (we have some experience with this: Byte Craft's Code Development Systems implement this, as a pragma, in SPECIAL memory declarations).

Data typing is application-dependent, not implementation-dependent. The definition of int in the last 15 years attests to this. First it was set as 16 bits, to support the PDP-11 natural word size. Later, it was intended to vary with the natural size of the processor, just in time for Byte Craft's first compilers. Now, it is expected to be the natural size of the processor or 16 bits, whichever is greater. We have switches in our compilers to support either 8- or 16-bit values as the default int size. We are seeing a rapid increase in the definition of new data types, and a trend that will have development tools check the data type usage. This ultimately will produce more reliable applications with very few restrictions on the implementor.

We have seen wide support for identifiable new data types. C99 supports the definition of new integer types, and a one bit Boolean int. But there is a fear that the language is getting too complex, balanced against the urge to support the realities of the application development community. ISO now publishes companion documents on the rationale behind the choices being made.

"Extensions for the Programming Language C to support Embedded Processors" has three main items:

  • New data types, including fixed, fract and accum to support DSP processors and fuzzy logic.

  • Named address space and user-defined address space (for example, I2C serial memory)

  • C language I/O support.

Byte Craft supports the development of solid, well-thought-out standards. We will continue to be an active contributor to ISO's WG14 (Working Group 14) to develop C standards for Embedded Systems, and work with our customers and competitors to develop solid standards to the benefit of application developers.

Note

ISO/IEC TR 18037 has received formal ISO approval.
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1275.pdf.