(correct standard) |
m |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{c title|Normative Addendum 1}}{{C standards}} | ||
'''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). | '''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). | ||
Line 7: | Line 8: | ||
== New headers == | == New headers == | ||
− | NA1 introduces 3 new standard headers: | + | NA1 introduces 3 new standard headers: {{C|iso646.h|<iso646.h>}}, {{C|wchar.h|<wchar.h>}}, and {{C|wctype.h|<wctype.h>}}; all of which are mandatory. |
== International keyboard == | == International keyboard == | ||
− | Due to growing international interest in the C language and the lack of some characters in various international keyboards, NA1 introduced | + | Due to growing international interest in the C language and the lack of some characters in various international keyboards, NA1 introduced {{C|iso646.h|<iso646.h>}} which defined 11 new macros that expand to operators that use ''&'', ''|'', ''~'', ''!'', and ''^''. For example the macro and_eq expands into &=. |
== Wide characters == | == Wide characters == | ||
Line 20: | Line 21: | ||
</source> | </source> | ||
− | 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. | + | 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. |
[[Category:C programming language]] | [[Category:C programming language]] | ||
[[Category:C standards]] | [[Category:C standards]] |
Latest revision as of 07:49, 4 January 2015
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[edit]
NA1 can be detected via the __STDC_VERSION__ mandatory macro which must equal 199409L.
New headers[edit]
NA1 introduces 3 new standard headers: <iso646.h>, <wchar.h>, and <wctype.h>; all of which are mandatory.
International keyboard[edit]
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[edit]
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.