The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.std.c
From: j...@ksr.com (John F. Woods)
Date: 25 Feb 92 14:51:52 EST
Local: Tues, Feb 25 1992 2:51 pm
Subject: Re: Why is this legal?
bhoug...@hopi.intel.com (Blair P. Houghton) writes:
>In article <10...@ksr.com> j...@ksr.com (John F. Woods) writes: "3.1.2.5 Types >>bhoug...@hopi.intel.com (Blair P. Houghton) writes: >>>struct foo *foo; >>>main(){ printf("*foo size: %d\n", sizeof(struct foo) ); >>At this point, the compiler is at liberty to generate a program which formats >>your hard disk drive. In fact, it probably should. 3.3.3.4, 1.6, six two and >>even, over and out. >But tell us WHY, Dr. Define.... A structure or union type of unknown content (as described in 3.5.2.3) is an incomplete type." "3.3.3.4 The sizeof Operator Constraints The sizeof operator shall not be applied to an expression that has function type or an incomplete type, to the parenthesized name of such a type, ..." "1.6 Definitions of Terms In this standard, ... "shall not" is to be interpreted as a prohibition. * Undefined behavior -- behavior, upon use of a nonportable or erroneous program construct, ... for which the standard imposes no requirements. Permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to having demons fly out of your nose." In short, you can't use sizeof() on a structure whose elements haven't been OK, OK; so the Standard doesn't *ACTUALLY* mention demons or noses. Not as You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||