Jump to content

Talk:C alternative tokens

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

ISO/IEC 646

[edit]

Does it have something to do with ISO/IEC 646? --Abdull (talk) 20:09, 7 February 2008 (UTC)[reply]

C99?

[edit]

Please confirm C99 as the introductory date. I believe this file predates that and was instead added with the Normative Amendment 1 in 1995 --Mario F. (talk) 12:19, 16 February 2008 (UTC)[reply]

Oops. Thanks for pointing this out. I will fix this. ← Michael Safyan (talk) 07:07, 17 February 2008 (UTC)[reply]

C++?

[edit]

"These identifiers are operator keywords in the ISO C++ programming language..." have they always been there or added in some later standard, if so which standard does this refer to? (62.64.150.166 (talk) 19:34, 8 January 2010 (UTC))[reply]

Visual c++

[edit]

It doesn't have those operators automatically so if you want to use them you have to include the header. VC++ holds a large share of c++ development on windows so I feel that this should be mentioned, even if this behavior is still against the standards, its useful to know for those who want compatibility with most compilers.141.157.181.175 (talk) 19:31, 13 February 2011 (UTC)[reply]

Intent of iso646.h

[edit]

This article mentions that the intent of iso646.h is to be able to input C source code with any variant of the ISO646 codepage.

According to the table listed in http://en.wikipedia.org/wiki/ISO/IEC_646#National_variants, the variable glyphs are:

  • # required for all preprocessor directives,
  • $, not used by C,
  • @, not used by C,
  • [ and ] used for dereferencing arrays – arrays can be accessed using pointer arithmetics since ptr[i] is syntactic sugar for *(ptr+i) but for static arrays, their declaration still needs those brackets,
  • \ used for:
    • encoding characters that in particular cannot be written as is in source code (classic examples: '\n', '\012', '\x0A'),
    • allowing a line to be continued on the next line (especially useful for macros),
  • ^ used for XORing, covered in iso646.h by xor and xor_eq,
  • { and } used for all blocks (functional and descriptive), required almost everywhere in C,
  • | used for OR operators, covered in iso646.h by or, bitor and or_eq,
  • ~ used for complementing a byte, covered in iso646.h by compl.

We can also notice that & and ! are not part of variable codes, while iso646.h proposes an alternate writing (and, and_eq, bitand, not, not_eq).

In parallel, digraphs and trigraphs have been developed...

My point of view is that this header is mostly a convenient way to write some operators (and only operators) using a textual and clear name instead of inserting symbols that, in fact for some, would require complex writing on restrictive variants of ISO646. It does not succeed at covering all cases, especially curly brackets that still need the use of digraphs and trigraphs. The header name may not be the most appropriate. Teuxe (talk) 17:32, 31 July 2012 (UTC)[reply]