Is a compiler allowed to add functions to standard headers?

In 4. “Conformance” §6, there is:

A conforming implementation may have extensions (including additional
library functions), provided they do not alter the behavior of any strictly conforming
program.

with the immediate conclusion in a footnote:

This implies that a conforming implementation reserves no identifiers other than those explicitly
reserved in this International Standard.

The reserved identifiers are described in 7.1.3. Basically, it is everything starting with an underscore and everything explicitly listed as used for the standard libraries.

So, yes the compiler is allowed to add extensions. But they have to have a name starting with an underscore or one of the prefixes reserved for libraries.

itoa is not a reserved identifier and a compiler defining it in a standard header is not conforming.

Leave a Comment