From WikiChip
Normative Addendum 1 - C
< c

C Standards

Standard Revisions

Technical Reports

Other

v · d · e

Normative Addendum 1 (also known as NA1, C94, and C95) is a standardized amendment to the C standard published in 1995 by ISO. The amendment was added in order to address the growing international need for international character sets support in C. The amendment is formally known as ISO/IEC 9899/AMD1:1995 (also ISO/IEC 9899 AM1).

NA1 added three new headers that added support for wide-characters, wide-strings, and international keyboard.

Version detection

NA1 can be detected via the __STDC_VERSION__ mandatory macro which must equal 199409L.

New headers

NA1 introduces 3 new standard headers: <iso646.h>, <wchar.h>, and <wctype.h>; all of which are mandatory.

International keyboard

Due to growing international interest in the C language and the lack of some characters in various international keyboards, NA1 introduced <iso646.h> which defined 11 new macros that expand to operators that use &, |, ~, !, and ^. For example the macro and_eq expands into &=.

Wide characters

NA1 introduced wide characters and wide character strings which use wchar_t instead of char capable of addressing an implementation defined character set which may have more characters than what a char would normally have. On linux for example, wchar_t is typically a 32-bit integer used to represent UTF-32 strings while on Windows a wchar_t is typically a 16-bit integer used to represent UTF-16.

wchar_t str[] = L"שָׁלוֹם\n";
wprintf(str);

Due to the lack of standardization of underling character set, it makes it very hard to write portable applications that takes advantage of wide characters since the size and the encoding varies significantly from implementation to implementation. This issue was addressed with the introduction of UTF-8, UTF-16, and UTF-32 encoded strings in C11 version of the C standard.