What is the ANSI C ++ standard


1.2 The ANSI-C standard

C was invented by Dennis Ritchie and Ken Thompson in 1972, although "invented" is not exactly the correct term. C was implemented due to some restrictions of the predecessor language B and was mainly developed for the UNIX operating system. Because before that UNIX was programmed entirely in assembler.

When the first freely available compilers for C appeared, the triumphant advance could no longer be stopped. C became the most successful language of all in the context of UNIX.

However, C was not designed to write software, but for programmers who developed compilers. And that was exactly where the problem was. Each compiler manufacturer did its own thing and added a few functions to the programming language or dropped one or the other existing function.

Over time, more and more different C dialects emerged, and porting from one system to another was tantamount to rewriting a program.

Eventually a group of compiler, hardware and software developers came together with the intention of solving the problem of the diversity of language dialects. The American National Standard Institute (ANSI for short) set up a committee called X3J11 in 1983 with the task of standardizing the C language.


ANSI standards

Of course, ANSI not only created the C standard, but is also responsible for countless other standards worldwide (see http://www.ansi.org/).


The committee developed a draft for a common standard and compliance with it. In 1989 the time had finally come: the draft was submitted and adopted by the International Standards Organization (ISO). In short, it was called the C89 standard (ANSI standard X3.159–1989). The software libraries (better known under the term ANSI C standard library) are part of the ANSI-C standard.

A later revision of the C standard added new header files to the library. In 1995, for example, the header files , and were added, which were designated as Normative Amendment 1 (NA1 for short).

Four years later, in 1999, the header files , , , , and were added. This revision then became known as the C99 standard.

Of course, not only were header files added, but C's main weaknesses were also improved. This has to be mentioned at this point, since the titles of books often read: "Corresponds to the new C99 standard". Often times, this statement refers to the major improvements in C rather than the new libraries.

The current C99 standard (ISO / IEC 9899: 1999) has meanwhile reached many compiler manufacturers and has largely been implemented.

If you want to read the standard, you have to purchase it, as there is no online version of it. The ISO standard is distributed in Geneva at the following address:

ISO Distribution Case Postale 56 CH-1211 Geneve 20 Suisse

However, you can also obtain a rationale via FTP from ftp.uu.net. In the directory doc / standards / ansi / X3.159–1989 you will find a corresponding Postscript file, which is also distributed by Silicon Press (ISBN 0–929306–07–4).


Rational

A rationale is an explanation of why the standardization committee made a decision one way and no other. However, this rationale is not part of the ANSI standard, which is why it is not included in the above-mentioned ISO standard. The rationale is for information only.


Since 2007 the standardization committee has been working on a new revision of the C standard. This standard is currently known as C1x. From this one can at least conclude that this standard should appear sometime between 2010 and 2019. In any case, the fact is that thread programming will then also be implemented in the standard, which is inevitable in view of the multiprocessor systems. It is also to be expected that the new C1x standard will contain new functions for embedded systems, different character sets (Unicode support), functions for dynamic memory reservation and checking of memory or buffer overflows, etc.


1.2.1 Which C standard is used in this book?

This heading might confuse one or the other, since the book is C99-compliant. That's right, the book here also describes the C99 standard. Unfortunately, some compiler manufacturers (including big names such as Microsoft or Borland; as of 2009) do not manage to implement the C99 standard completely. So in this book I have no choice but to point out again and again that this or that corresponds to the C99 standard and therefore only works with compilers that have implemented this standard. The compilers GCC, Sun Studio (software), Open Watcom C compilers and Intel C / C ++ are particularly noteworthy with regard to the support of the C99 standard.


Note

The syntax descriptions for the functions of the standard C library can be found in the C99 standard. Basically there is actually no difference here, only that in the C99 standard some functions are declared with the restrict pointer. More on this can be found in the relevant section 12.13.



1.2.2 The advantage of the ANSI-C standard

The main advantage of the ANSI-C standard is the portability of C programs. This means: If you have written a program on platform A and have compiled it, this program can also be compiled on platform B. Of course, this means a new translation of the source code and not the executable program. ANSI-C compilers are available for over 40 systems, from the smallest 8-bit computer to supercomputers.

On the other hand, hardware-related or operating system-specific operations are not portable. For example, if you write a program for UNIX / Linux that addresses the graphics card, the program will refuse to run on other systems.

There are of course a number of other standards that are not covered in this book.



your opinion

How did you like the Openbook? We always look forward to your feedback. Please send us your feedback as an e-mail to [email protected]