public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* zero length array example does not compile
@ 2023-04-25 12:13 Jonny Grant
  2023-04-25 12:17 ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Jonny Grant @ 2023-04-25 12:13 UTC (permalink / raw)
  To: GCC

Hello

https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

I wondered 'this_length' refers to in that example, it doesn't compile.

<source>: In function 'main':
<source>:13:34: error: 'this_length' undeclared (first use in this function)
   13 |   malloc (sizeof (struct line) + this_length);
      |                                  ^~~~~~~~~~~


https://godbolt.org/z/PWEcWsrKv

I probably the size of the struct? So that would be 4 bytes for me, as it is just the int. That doesn't seem very useful. Maybe I am missing something.

Kind regards
Jonny

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-26 11:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 12:13 zero length array example does not compile Jonny Grant
2023-04-25 12:17 ` Jonathan Wakely
2023-04-25 12:22   ` Jonathan Wakely
2023-04-25 19:21     ` Jonny Grant
2023-04-25 20:04       ` Jonathan Wakely
2023-04-26 11:26         ` Jonny Grant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).