🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Cay S. Horstmann Tue, 30 Jan 1996 04:47
and, or, not
#3140
Author: Cay S. Horstmann
Date: Tue, 30 Jan 1996 04:47
28 lines
1628 bytes
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!

Cay
horstman@cs.sjsu.edu
---
[ 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. ]
Re: and, or, not
#3164
Author: Steve Clamage
Date: Tue, 30 Jan 1996 16:31
48 lines
2371 bytes
In article 7nb@jupiter.SJSU.EDU, horstman@jupiter.SJSU.EDU (Cay S. Horstmann) 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++?

Yes.

>That is, are "and", "or", "not", now reserved words in ALL C++
>programs, 

Yes. That is a difference from C, where they are macros in standard
header file <iso646.h>.

Those are not the only new replacements for the funny symbols. Here is
a complete list, from section 2.4 "Alternative tokens" in the draft:

Table 2 -- alternative tokens 
altern.	primary 	altern.	primary		altern. primary
<% 	{		and	&&		and_eq	&=
%>	}		bitor	|		or_eq	|=
<: 	[		or	||		xor_eq	^=
:>	]		xor	^		not	!
%:	#		compl	~		not_eq	!=
%:%:	##		bitand	&

The alternative tokens and corresponding primary tokens are functionally
equivalent; you can use either form in an expression, and you need not
be consistent. The corresponding forms behave differently only when
"stringized".

The C++ Committee did not invent these, and asked for some of the more
peculiar-looking items to be changed. But these are what was adopted
by other ISO bodies, and it makes more sense to go along with them
than to introduce incompatibilities.
---
Steve Clamage, stephen.clamage@eng.sun.com



[ 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. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads