Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: What's the idea with ALLEGRO.H's zero-size arrays? Date: Mon, 1 Nov 1999 15:27:29 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Reply-To: djgpp AT delorie DOT com Forsberg Sakari writes: > I tried to compile my new program with '-pedantic' switch, but > djgpp shows me following data.... > > djgpp/include/allegro.h:948: warning: ANSI C++ forbids zero-size array `line' > djgpp/include/allegro.h:1498: warning: ANSI C++ forbids zero-size array `dat' > What's the idea with zero-size arrays? These are dynamically allocated structures where the exact size depends on what you are storing in it, for example bitmaps contain a table of line pointers, and how many pointers are required depends on how high that bitmap is. Although this isn't strictly part of the C language spec, it works on all the compilers that Allegro supports, and is a significant performance improvement over doing it the clean way by putting the variable size information into a second structure and just referencing it by pointer. Solution: don't use -pedantic. It's a silly option anyway, at least according to the gcc developers (see "info gcc invoking warning"). Shawn Hargreaves.