cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/01/11:46:12

Message-ID: <F77915E7F086D31197F4009027CC81C9054782@ASL-NT-EXCH2>
From: Shawn Hargreaves <SHargreaves AT acclaimstudios DOT co DOT uk>
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)
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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019