Mail Archives: djgpp/1999/11/01/11:46:12
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.
- Raw text -