🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2027

What type is yielded by bitwise & | ^

#2027
From: Ron Guilmette
Date: Mon, 03 Dec 1990 06:51
43 lines
1788 bytes
The title line pretty much says it.

Perhaps I'm looking at an old draft standard when I should be looking
at something newer, but what I really need to know this and I hope
somebody will help me out.

(I know... I know... you want to know which way I came in. :-)

It looks to me like the sections of the standard which describe most
of the binary operators also state explicitly what the type of the
result will be.

In the case of bitwise-and, bitwise-ior, and bitwise-xor however I can't
see where the result type is defined.

Harbison & Steel say that the result type for these is the same as the
(promoted) operands, but I'd like to know where it says that in the
actual standard document.

Also, while we are on the subject...

Given some binary operator `@', and given:

	int i;
	long l;

		... i @ l ...

where does the standard say that `i' must get implicitly widened to
match `l'?  Is that even required for EACH AND EVERY binary operator?
How about:

		... l << i ...
		... i << l ...

Is there any reason to widen `i' in either of these cases?

If operands of binary operators are implicitly coerced to be the same
type before the operation is actually performed, and if this only happens
for some subset of C's binary operators, then please tell me which binary
operators (specifically) this rule applies to.

Thanks.
Technical Details
Message-ID: <2881@lupine.NCD.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!lupine.ncd.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!lupine.ncd.com
From: rfg@lupine.ncd.com (Ron Guilmette)
Newsgroups: comp.std.c
Subject: What type is yielded by bitwise & | ^
Message-ID: <2881@lupine.NCD.COM>
Date: 3 Dec 90 06:51:11 GMT
Sender: rfg@NCD.COM
Organization: Network Computing Devices, Inc., Mt. View, CA
Lines: 43