[AD] Proposal: removal of zero-sized arrays |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
As the title says, I propose that we remove zero-sized arrays from the
library.
Advantages:
- dat2c will work nicely :-)
- more generally, it is possible to statically-initialise structures
with zero-sized arrays (you might want to do this for sub bitmaps
etc. to make sure that their creation never fails, thus simplifying
your code)
- makes the code a little simpler in certain places (ie. the ZERO_SIZE
macro in header files, etc)
- AIUI zero-sized arrays are not ANSI C [1] (as always, please correct
me if I'm wrong)
Disadvantages:
- requires somebody to do the work (I volunteer) and some work checking
and applying
- increases instance size by sizeof(void*) + alignment
- functions creating such structures require an extra line of code
What stays the same:
- no code (library or user), with the sole exception of object
creation, needs to be changed
- still only one malloc() call is required
[1] http://www.eskimo.com/~scs/C-faq/q2.6.html
Bye for now,
- --
Laurence Withers, lwithers@xxxxxxxxxx
(GnuPG 04A646EA) http://www.lwithers.demon.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
iD8DBQE9pKEkUdhclgSmRuoRAhQqAKCBZtRgi2jzCLzCIJin632xmxAPmACgkWsU
evl1L2nzricgKb5vGGJXhrk=
=wR44
-----END PGP SIGNATURE-----