home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!srhqla!quest!kdq
- From: kdq@quest.UUCP (Kevin D. Quitt)
- Newsgroups: comp.lang.c
- Subject: Re: Is this ANSI?
- Message-ID: <JTqNuB1w165w@quest.UUCP>
- Date: Sun, 22 Nov 92 12:30:30 PST
- References: <1992Nov21.125038.26244@sq.sq.com>
- Reply-To: srhqla!quest!kdq
- Organization: Job quest (805) 251-8210, So Cal: (800) 400-8210
- Lines: 34
-
- >>>struct FM
- >>>{
- >>> short data_len;
- >>> char data[]; /* This line is the kicker */
- >>>};
-
- My apologies for asking a question and not being around for the
- discussion; my upstream site dropped two days of news and mail on the
- floor. There is a legitimate reason for using the data field of the
- above struct: it's a handle for the data that follows the header.
-
- The actual header consists of a number of items, including a data
- count which can be 0 or more. The data is arriving via a tcp socket,
- so short of outrageous timeouts, we need some way to know when
- everything has arrived. The header structure is fixed size, and the
- data that follow is one of several different structures, or free form
- data (for being transmitted to other processes).
-
- The data field of FM lets me write code like:
-
- struct s1 *s1p = FM.data;
-
- instead of
-
- struct s1 *s1p = (struct s1 *)((char *)&FM + sizeof(struct FM));
-
- From the one article I did see, it appears that ANSI allows this
- usage of null arrays, but does not require it. Too bad. Well, I'll
- know for sure Tuesday, when I get my copy of the (old) ANSI document;
- at $184 including shipping and tax, it's cheap at half the price.
-
-
- _
- Kevin D. Quitt 96.37% of all statistics are made up. srhqla!quest!kdq
-