🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3168

Re: and, or, not

#3168
From: Beman Dawes
Date: Thu, 01 Feb 1996 01:32
66 lines
3738 bytes
In article <4ej3t4$7nb@jupiter.SJSU.EDU>, Cay S. Horstmann
 (horstman@jupiter.SJSU.EDU) writes:

>I just got a press release from Borland that says their upcoming 5.0
>compiler will support keywords and, or, not, that are synonyms to &&,
>|| and !. 
>
>They say you can use those if your local keyboard makes it difficult
>to write the traditional tokens. Hell, my local eyes make it difficult
>to read them. Does that mean I can from now on just write
>       if (0 <= x and x <= 1) . . .
>and be in conformance with ANSI C++?
>
>That is, are "and", "or", "not", now reserved words in ALL C++
>programs, or do you actually have to reside in a foreign country and
>first use some preprocessor (like that trigraph filter) to get them?
>
>If the answer is "they are reserved words in the language", then I'll
>add
>       #define and &&
>       #define or ||
>       #define not !
>into my personal setup file today, until my compiler understands them
>natively. Hooray!

Funny you should ask.  I just looked it up this morning:

  2.9  Keywords                                                [lex.key]

1 The identifiers shown in Table 3 are reserved for use as keywords, and
  shall not be used otherwise in phases 7 and 8:

                            Table 3--keywords

  +--------------------------------------------------------------------------+
  |asm          do             inline             short         typeid       |
  |auto         double         int                signed        typename     |
  |bool         dynamic_cast   long               sizeof        union        |
  |break        else           mutable            static        unsigned     |
  |case         enum           namespace          static_cast   using        |
  |catch        explicit       new                struct        virtual      |
  |char         extern         operator           switch        void         |
  |class        false          private            template      volatile     |
  |const        float          protected          this          wchar_t      |
  |const_cast   for            public             throw         while        |
  |continue     friend         register           true                       |
  |default      goto           reinterpret_cast   try                        |
  |delete       if             return             typedef                    |
  +--------------------------------------------------------------------------+

2 Furthermore, the alternative representations shown in Table 4 for cer-
  tain  operators and punctuators (_lex.digraph_) are reserved and shall
  not be used otherwise:

                   Table 4--alternative representations

            +------------------------------------------------+
            |and      and_eq   bitand   bitor   compl    not |
            |not_eq   or       or_eq    xor     xor_eq       |
            +------------------------------------------------+

--Beman
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <1198@dawes.win.net>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back

Show Full Headers
Complete Article Headers
From: beman@dawes.win.net (Beman Dawes)
Message-ID: <1198@dawes.win.net>
X-Original-Date: Tue, 30 Jan 1996 17:14:07
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 01 Feb 96 01:32:27 GMT
Approved: fjh@cs.mu.oz.au
Organization: -
Newsgroups: comp.std.c++
X-Mailer: WinNET Mail, v2.61
Reply-To: beman@dawes.win.net (Beman Dawes)
Subject: Re: and, or, not
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMRAYQOEDnX0m9pzZAQE6fQF+ORhKNiE4Ha9vUIWEPVwBPmqqBz+qh1Xk
 +KIOY6/CReNpDGm7tYvF3hcd1fw136SQ
 =7iv8