{{Short description|C standard library header providing a set of alternative spellings of common operators}} {{C Standard Library}}
'''C alternative tokens''' refer to a set of alternative spellings of common operators in the C programming language. They are implemented as a group of macro constants in the C standard library in the <code><iso646.h></code> header. The tokens were created by Bjarne Stroustrup for the pre-standard C++ language<ref name="Grill_the_Committee_2018">{{cite web |title=CppCon 2017: Panel "Grill the Committee" | website=YouTube |url=https://www.youtube.com/watch?v=JYG5LFHkUuE&t=4582 |archive-url=https://ghostarchive.org/varchive/youtube/20211212/JYG5LFHkUuE| archive-date=2021-12-12 |url-status=live}}{{cbignore}}</ref> and were added to the C standard in a 1995 amendment to the C90 standard via library to avoid the breakage of existing code.
The alternative tokens allow programmers to use C language bitwise and logical operators which could otherwise be hard to type on some international and non-QWERTY keyboards. The name of the header file they are implemented in refers to the ISO/IEC 646 standard, a 7-bit character set with a number of regional variations, some of which have accented characters in place of the punctuation marks used by C operators.
== The macros == The <code><iso646.h></code> header defines the following 11 macros as stated below:<ref name="Rationale_2003_C">{{cite web |title=Rationale for International Standard - Programming Languages - C |version=5.10 |date=April 2003 |url=http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf |access-date=2010-10-17 |url-status=live |archive-url=https://web.archive.org/web/20160606072228/http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf |archive-date=2016-06-06}}</ref>
{| class="wikitable" style="text-align:center" |- ! style="padding-left:1em;padding-right:1em"<!--remove?--> | Macro ! Defined as |- | <code>and</code> || <code>&&</code> |- | <code>and_eq</code> || <code>&=</code> |- | <code>bitand</code> || <code>&</code> |- | <code>bitor</code> || <code><nowiki>|</nowiki></code> |- | <code>compl</code> || <code>~</code> |- | <code>not</code> || <code><nowiki>!</nowiki></code> |- | <code>not_eq</code> || <code><nowiki>!=</nowiki></code> |- | <code>or</code> || <code><nowiki>||</nowiki></code> |- | <code>or_eq</code> || <code><nowiki>|</nowiki>=</code> |- | <code>xor</code> || <code>^</code> |- | <code>xor_eq</code> || <code>^=</code> |}
== C++ == The above-mentioned identifiers are operator keywords in the ISO C++ programming language and do not require the inclusion of a header file.<ref name="Stroustrup_1994_DEC">{{cite book |title=Design and Evolution of C++ |author-first=Bjarne |author-last=Stroustrup |author-link=Bjarne Stroustrup |publisher=Addison-Wesley Publishing Company<!-- AT&T Bell Labs --> |edition=1st |date=1994-03-29 |isbn=0-201-54330-3}}</ref> For consistency, the C++98 standard provided both <code><iso646.h></code> and a corresponding <code><ciso646></code>. However they both had no effect, being empty.<ref>{{cite book | isbn = 0-596-00298-X | title = C++ in a Nutshell | last = Lischner | first = Ray | page = 384 | publisher = O'Reilly Media | year = 2003 }}</ref><ref>{{cite book|first1=Peter|last1=Van Weert|first2=Marc|last2=Gregoire|year=2019|title=C++17 Standard Library Quick Reference|publisher=Apress|isbn=9781484249239|page=277}}</ref> Some compilers, such as Microsoft Visual C++ have, at least in the past, required the header to be included in order to use these identifiers unless a compiler flag is set.<ref>{{cite book|first1=Paul|last1=Deitel|first2=Harvey M.|last2=Deitel|title=C++11 for Programmers|year=2013|isbn=9780133439878|publisher=Pearson Education|page=928}}</ref><ref>{{Cite web|date=2021-11-23|title=Logical AND Operator: <code>&&</code>|url=https://docs.microsoft.com/en-us/cpp/cpp/logical-and-operator-amp-amp?view=msvc-170#operator-keyword-for-|url-status=live|access-date=2021-12-27|website=Microsoft Docs|archive-url=https://web.archive.org/web/20211228013621/https://docs.microsoft.com/en-us/cpp/cpp/logical-and-operator-amp-amp?view=msvc-170 |archive-date=2021-12-28 }}</ref> The header <code><ciso646></code> was deprecated in C++17, and removed in C++20,<ref>{{cite web|title=<ciso646>|date=2021-12-07|first1=Tyler|last1=Whitney|url=https://learn.microsoft.com/en-us/cpp/standard-library/ciso646|website=Microsoft Learn}}</ref> while <code><iso646.h></code> was retained for compatibility with C.<ref>{{cite journal|first=Thomas|last=Köppe|date=2021-06-11|publisher=ISO/IEC JTC1 SC22 WG21|title=Clarifying the status of the "C headers"|journal=C++ Standards Committee Papers|url=https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2340r1.html|url-status=live|archive-date=2024-01-11|archive-url=https://web.archive.org/web/20240111125009/https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2340r1.html}}</ref>
== See also ==
==References== {{reflist}}
== External links == * {{man|bd|iso646.h|SUS|alternative spellings}}
Category:C (programming language)