Article View: comp.std.c
Article #3220Re: call to revolt
From: Tim McDaniel
Date: Thu, 27 Jun 1991 15:07
Date: Thu, 27 Jun 1991 15:07
64 lines
3242 bytes
3242 bytes
Oh, dear. I had thought this horse had fossilized by now.
In article <4880@inews.intel.com> bhoughto@bishop.intel.com (Blair P.
Houghton) writes:
This'll do it, too:
thing += (int *)1;
(see ANSI X3.159-1989, sec. 3.3.16.2, p. 55, ll. 20-21, and
footnote 51 at the bottom of p. 51, for proof...)
In the ANSI-published version, footnote 51 is at the bottom of page
54, and deals with "the asymmetric appearance of these constraints
with respect to type qualifiers" in simple assignment, which means
"=". It is therefore entirely irrelevant. Page 51 has no footnotes.
Perhaps footnote 46 on page 48 was meant? It deals with pointer
arithmetic, but is careful to specify "*integral* expression added to
or subtracted from the converted pointer" (emphasis mine).
The above-referenced p. 55, ll. 20-21 does say, under "Semantics" of
"Compound Assignment":
A *compound* *assignment* of the form E1 *op*= E2 differs from the
simple assignment expression E1 = E1 *op* (E2) only in that the
lvalue E1 is evaluated only once.
However, the "Constraints" six lines up read:
For the operators += and -= only, either the left operand shall be
a pointer to an object type and the right shall have integral type,
or the left operand shall have qualified or unqualified arithmetic
type and the right shall have arithmetic type.
"(int *) 1" does not have integral type; it has pointer type. Pointer
types and integral types are clearly distinguished in section 3.1.2.5,
"Types".
Section 3.3.6, "Additive Operators" (p. 47), (which applies due to the
"Semantics" section quoted above) has the constraint
For addition, either both operand shall have arithmetic type, or
one operand shall be a pointer to an object type and the other
shall have integral type.
In section 3.3.4, "Cast Operators", in "Semantics",
An arbitrary integer may be converted to a pointer. The result is
implementation-defined. \footnote{45. The mapping functions for
converting a pointer to an integer or an integer to a pointer are
intended to be consistent with the addressing structure of the
execution environment.}
In short: bullshit.
--Tim
"More accurately, it's fossilized
horseshit."
--
"Of course he has a knife; he always has a knife. We all have knives.
It's 1183 and we're barbarians." -- Eleanor of Aquitaine, "A Lion in Winter"
Tim McDaniel Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
Internet: mcdaniel@adi.com UUCP: {uunet,sharkey}!amara!mcdaniel
Technical Details
Message-ID:
<MCDANIEL.91Jun27110701@dolphin.adi.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!umich!sharkey!amara!mcdanielReferences:
<rabson.677868220@physics.ubc.ca> <992@baby.and.nl> <782@taumet.com> <4880@inews.intel.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!umich!sharkey!amara!mcdaniel From: mcdaniel@adi.com (Tim McDaniel) Newsgroups: comp.std.c Subject: Re: call to revolt Message-ID: <MCDANIEL.91Jun27110701@dolphin.adi.com> Date: 27 Jun 91 15:07:01 GMT References: <rabson.677868220@physics.ubc.ca> <992@baby.and.nl> <782@taumet.com> <4880@inews.intel.com> Sender: news@adi.COM Organization: Applied Dynamics International, Inc.; Ann Arbor, Michigan, USA Lines: 64 In-reply-to: bhoughto@bishop.intel.com's message of 27 Jun 91 01:53:14 GMT