Shifting question
William E. Davidsen Jr
davidsen at steinmetz.ge.com
Tue Jul 26 01:46:52 AEST 1988
henry at utzoo.uucp (Henry Spencer) writes:
| You have an out-of-date draft, I believe. The second-public-comment draft
| (I haven't seen the third yet) explicitly forbids sizeof in this context.
I believe what I have is current. I got it a week ago and it's marked
as THIRD public review. The many references were all based on that
draft.
Another note, from the sizeof (3.3.3.4) section, line 23.
Constraints
===========
The _sizeof_ operator shall not be applied to an expression
function type or an incomplete type, to the parenthesized name
of such a type, or to an lvalue that designates a bitfield
object.
Chris Tokek said that there was a obscure phrase which
disallowed use of sizeof in the preprocessor, but 3.8.1 on the
#if says that the 2nd argument is a constant expression, and 3.4
(constant expressions) says:
Constraints
===========
Constant expression shall not contain assignment, increment,
decrement, function call, or comma operators, except when they
when they are contained within the operand of a sizeof operator.
This is the only reference to constant expression in the index. If
the semantics of the #if say that the first field is a constant
expression, and the definition of constant expression specifically
includes sizeof, either sizeof is legal in the expression of #if, or
perhaps the phrase is a bit too obscure.
I didn't think this was legal, but after some time checking the
standard I thank that the standard *seems* to say that it is.
Since this discussion has gotten split between comp.std.c, comp.lang.c and
comp.arch, I have directed followup to comp.std.c, since the question
has changed to a standards issue.
--
bill davidsen (wedu at ge-crd.arpa)
{uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me
More information about the Comp.lang.c
mailing list