Re: [AD] Proposal: removal of zero-sized arrays |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 10 October 2002 10:13, Sven Sandberg wrote:
[snip]
> Probably tons of asm code needs to be rewritten. With zero-sized
> arrays it is:
>
> line_ptr = bmp_ptr + static_offset
>
> Without zero-sized arrays it will be
>
> line_ptr = *(bmp_ptr + static_offset)
Yes, you are right. I'm not sure about 'tons', though :-)
On Thursday 10 October 2002 08:55, Eric Botcazou wrote:
> > - 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)
>
> Don't you want to remove zero-sized arrays ?
A wording mistake. "More generally, it is possible to
statically-initialise structures that currently use zero-sized arrays
[if we make the change]". This is because it is not always possible to
statically initialise a zero-sized array (as we discovered with dat2c).
NB: by zero-sized arrays, I mean whatever you want to call unsized
arrays in terminal positions.
On Thursday 10 October 2002 08:42, Christer Sandberg wrote:
> > - dat2c will work nicely :-)
>
> Can be done in other ways as well. Won't it be necessary to call an
> init-function if you introduce this?
Nope, because you can write the line[] array or whatever as a static
array, and then use the array name as a pointer to the first element
(which, as discussed earlier, is a compile-time constant).
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)
iD8DBQE9pVQdUdhclgSmRuoRAvA+AJ9kUcW95PpRIa9XM2alC+QKGw2jeQCeJn+P
zAnrdCfIQrJla2owSSj6nGI=
=TG3d
-----END PGP SIGNATURE-----