🔒 Locked
C++ Keyword?
Advertisement
Original Post
Quote:
Original post by PKLoki
More to the point, if they work the same why not just use && and ||? Less typing!
Another mystery solved:
Quote:
[iso646.h] defines a number of macros which allow programmers to use C language bitwise and logical operators, which, without the header file, cannot be quickly or easily typed on some international and non-QWERTY keyboards.
It simply was not possible to type thoes symbols on some keyboards :)
Simiarly trigraphs were introduced to solve the same problem (albeit for different characters).
Quote:
The reason for their existence is that the basic character set of C (a subset of the ASCII character set) includes nine characters which lie outside the ISO 646 invariant character set. This can pose a problem for writing source code if the keyboard being used does not support any of these nine characters. The ANSI C committee invented trigraphs as a way of entering source code using keyboards that supported any version of the ISO 646 character set. Non-ASCII ISO 646 character sets are not much used today, but trigraphs remain in the C99 standard[
[Edited by - fpsgamer on July 20, 2008 8:29:42 PM]
Quote:
Original post by Zahlman
Or you could use them to save the person reading the code the mental effort of translating the symbol into the English word. And seriously - that's a savings of one character for '&&' vs 'and', and zero for '||' vs 'or'. Big whoop.
Actually if you count having to hit the shift key (on American keyboards at least), && is the same at three strokes and || is more typing than or.
Great.. So now we have trigraphs, digraphs and these cute and/or things to deal with what ought to be a non-issue nowadays. Besides if you wanted to speed up typing then wouldn't begin/end macros for { and } have made a lot more sense? IIRC those took a three-key combo involving the numpad on my Amiga.
Here's the deal, if you're a C programmer then you can bloody well buy yourself an English keyboard or at least switch to a reasonable keyboard layout. That's what I do, and so does every other coder I know.
Here's the deal, if you're a C programmer then you can bloody well buy yourself an English keyboard or at least switch to a reasonable keyboard layout. That's what I do, and so does every other coder I know.
Quote:
Original post by dmatter
VC++2008 doesn't seem to support them without #include. In C++ I think they're meant to 'just work' without any headers, but whatever. [rolleyes]
Yeah , Microsoft's compiler is nonconforming in this area since you should be able to use them without needing to include the header:
These identifiers are keywords in the ISO C++ programming language and do not require the inclusion of a header file. For consistency, however, the C++98 standard provides the header
I found this out a while back trying to compile a custom library that makes liberal use of the new keywords and couldn't get it to compile under MS VC++ and at the time the MSDN help system never mentioned iso646 was necessary and it took me a while to figure out I needed to include that header!
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement