home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ornl!rsg1.er.usgs.gov!darwin.sura.net!zaphod.mps.ohio-state.edu!usc!srhqla!quest!kdq
- From: kdq@quest.UUCP (Kevin D. Quitt)
- Newsgroups: comp.lang.c
- Subject: Is this ANSI?
- Message-ID: <9eRguB1w165w@quest.UUCP>
- Date: Wed, 18 Nov 92 18:00:19 PST
- Reply-To: srhqla!quest!kdq
- Organization: Job quest (805) 251-8210, So Cal: (800) 400-8210
- Lines: 40
-
- I'm working on an HP9000, in UNIX, using the native C compiler
- which claims to be ANSI compliant. It appears to be, in most things,
- even though you've got to jump through hoops to really get it into ANSI
- mode with the correct ANSI includes.
-
- Here is (a simplified version of) the struct that the compiler
- calls an error:
-
- struct FM
- {
- short data_len;
- char data[]; /* This line is the kicker */
- };
-
- As I recall, ANSI says this is legal, with sizeof( struct FM) is 2
- bytes, and offsetof( struct FM, data) is 2.
-
- I note that the FAQ does not address this issue directly. It
- states (in question 9.6) that the ANSI C standard allows:
-
- struct name
- {
- int namelen;
- char name[1];
- };
-
- only implicitly.
-
- So, I have two questions: Is the original structure legal ANSI
- code? And if so, what does it take to make HP's cc be ANSI compliant
- (-Aa ain't enough) (or have I really found a bug?). BTW, all my other
- compilers have no complaints - the HP compiler does just issue a
- warning, it craps out.
-
- Thanks in advance. (P.S. email preferred unless you think it's of
- general interest)
-
-
- _
- Kevin D. Quitt 96.37% of all statistics are made up. srhqla!quest!kdq
-