Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #388583
| From | Kaz Kylheku <643-408-1753@kylheku.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | sizeof struct with flexible array: when did it change? |
| Date | 2024-10-07 02:32 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <20241006192337.76@kylheku.com> (permalink) |
C99 said that the size of a structure that ends in a flexible array member is the same as the offset of that flexible member in a similar structure in which the array has some unspecified size. The latest draft says that the size is calculated as if the flexible array member were omitted, except that there may be more padding than the omission would imply. I can't think of a reasonable interpretation of the original wording which would allow the size to be other than the offset of the array, when the array is of a character type. The current wording clearly does allow the size to go beyond the offset in that case. Don't get burned: don't rely on the size of a flexible array struct. Use the offsetof that flexible member. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca
Back to comp.lang.c | Previous | Next — Next in thread | Find similar
sizeof struct with flexible array: when did it change? Kaz Kylheku <643-408-1753@kylheku.com> - 2024-10-07 02:32 +0000
Re: sizeof struct with flexible array: when did it change? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-10-06 20:43 -0700
Re: sizeof struct with flexible array: when did it change? Nick Bowler <nbowler@draconx.ca> - 2024-10-07 18:32 +0000
Re: sizeof struct with flexible array: when did it change? Kaz Kylheku <643-408-1753@kylheku.com> - 2024-10-07 23:42 +0000
Re: sizeof struct with flexible array: when did it change? Jeremy Brubaker <jbrubake.362@orionarts.invalid> - 2024-10-09 12:55 +0000
Re: sizeof struct with flexible array: when did it change? scott@slp53.sl.home (Scott Lurndal) - 2024-10-09 15:06 +0000
Re: sizeof struct with flexible array: when did it change? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-10-13 21:55 -0700
csiph-web