Xref: utzoo comp.arch:5689 comp.lang.c:11495 comp.std.c:207 Path: utzoo!attcan!uunet!steinmetz!davidsen From: davidsen@steinmetz.ge.com (William E. Davidsen Jr) Newsgroups: comp.arch,comp.lang.c,comp.std.c Subject: Re: Shifting question Message-ID: <11637@steinmetz.ge.com> Date: 25 Jul 88 15:46:52 GMT References: <705@bnr-rsc.UUCP> <11556@steinmetz.ge.com> <1988Jul19.173807.6604@utzoo.uucp> <11606@steinmetz.ge.com> <1988Jul23.231300.22872@utzoo.uucp> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Followup-To: comp.std.c Organization: General Electric CRD, Schenectady, NY Lines: 47 henry@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@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me