🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: and, or, not

#3301
From: Steve Clamage
Date: Wed, 07 Feb 1996 21:13
52 lines
2264 bytes
In article 458E@bridge.com,  Rod Burman <rodb@bridge.com> writes:
>
>> >>                   Table 4--alternative representations
>> >
>> >>            +------------------------------------------------+
>> >>            |and      and_eq   bitand   bitor   compl    not |
>> >>            |not_eq   or       or_eq    xor     xor_eq       |
>> >>            +------------------------------------------------+
>> 		YET
>> >This leads to ^ another question:
>
>Is the committee thinking of some how linking these with operator 
>overloading?
>	e.g.	operator^() == operator.xor() xor operator_xor()
>
>or do you just use trigraphs for this particular usage?

When you write
	operator^()
that phrase consists of four tokens:
	operator  ^  (  )

The "^" token can be spelled in three ways:
	^
	xor
	??'
All three spellings are equivalent, and it doesn't matter which you use
when referring to the operator. So you could write:

	int operator^(const T&, const T&); // declare function
	T a, b, c, d, e, f;
	...
	int i = a ^ b;			// call function 3 times
	int j = c ??' d;
	int k = operator xor(e, f);
	...
	int operator??'(const T& t1, const T& t2) { ... } implement function

The only time a difference shows up in the token spellings is if you
"stringize" the token via a "#" in a macro.
	# ^   becomes "^"
	# ??' becomes "^"	// because ??' is converted to ^ before anything else
	# xor becomes "xor"
---
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://reality.sgi.com/employees/austern_mti/std-c++/policy.html
]
Technical Details
Message-ID: <4fb3f5$or1@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <3118FDEF.458E@bridge.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: clamage@Eng.sun.com (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: and, or, not
Date: 7 Feb 1996 21:13:26 GMT
Organization: Sun Microsystems Inc.
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <4fb3f5$or1@engnews1.Eng.Sun.COM>
References: <3118FDEF.458E@bridge.com>
Reply-To: clamage@Eng.sun.com
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: taumet.eng.sun.com
Content-Length: 1443
X-Lines: 47
Originator: clamage@taumet