public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39383]  New: sizeof object with zero-length array ignores initializer
@ 2009-03-05 12:39 algrant at acm dot org
  2009-03-05 13:06 ` [Bug c/39383] " ebotcazou at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: algrant at acm dot org @ 2009-03-05 12:39 UTC (permalink / raw)
  To: gcc-bugs

Example from docs: 
  struct f1 { int x; int y[]; } f1 = { 1, { 2, 3, 4 } };
Currently sizeof(f1) == sizeof(int) rather than 4*sizeof(int), i.e.
sizeof the object is determined by the type only, not the actual object
size taking into account its initializer.  If this is intentional the
docs could benefit from clarification, as otherwise it's natural to
want to use sizeof to find out how big the object actually ended up as.


-- 
           Summary: sizeof object with zero-length array ignores initializer
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: algrant at acm dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39383


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

end of thread, other threads:[~2009-04-23 15:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-05 12:39 [Bug c/39383] New: sizeof object with zero-length array ignores initializer algrant at acm dot org
2009-03-05 13:06 ` [Bug c/39383] " ebotcazou at gcc dot gnu dot org
2009-03-05 13:19 ` algrant at acm dot org
2009-03-05 13:31 ` ebotcazou at gcc dot gnu dot org
2009-03-05 13:53 ` joseph at codesourcery dot com
2009-03-05 14:48 ` algrant at acm dot org
2009-03-06 14:45 ` algrant at acm dot org
2009-03-06 17:27 ` jsm28 at gcc dot gnu dot org
2009-04-08 21:36 ` b07584 at freescale dot com
2009-04-08 22:54 ` joseph at codesourcery dot com
2009-04-17 22:39 ` anmol at freescale dot com
2009-04-23 15:53 ` anmol at freescale dot com

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).