>> >Can someone pls tell me if it is possible to define an array of size 0. >> >> Not in C. > >GCC and most other compilers support it. >I do it all the time (see all the various netgraph structures) however it must >be the LAST item in the structure. It gives the address of the first byte >AFTER the structure. This is very useful if the structure is a header of some >sort. While I prefer the 0-element method too, the ANSI standard doesn't allow it. Fortunately there is a portable way to get the same effect. Just put a 1-element array at the end of your header struct, and account for it when you work out how much extra space to allocate. C memory layout rules guarantee that this usage will have the desired effect. Todd Whitesel toddpw @ best.com To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
- Question regarding the array of size 0. Shankar Agarwal
- Re: Question regarding the array of size 0. Peter Seebach
- Re: Question regarding the array of size 0. John Franklin
- Re: Question regarding the array of size 0. Peter Seebach
- Re: Question regarding the array of size 0. Johan Danielsson
- Re: Question regarding the array of size 0. Julian Elischer
- Re: Question regarding the array of size 0. Todd Whitesel
- Re: Question regarding the array of size... Peter Seebach
- Re: Question regarding the array of... Alfred Perlstein
- Re: Question regarding the arra... Harti Brandt
- Re: Question regarding the ... Lord Isildur
- Re: Question regarding the ... John Franklin
- Re: Question regarding the ... Lord Isildur
- Re: Question regarding the ... John Franklin
- Re: Question regarding the ... Benny Prijono
- Re: Question regarding the ... John Gregor
- Re: Question regarding the ... Greg A. Woods

