[Bug 18] int foo[0] accept -- what's its semantics?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 9 07:59:37 PDT 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=18
smjg at iname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
------- Comment #5 from smjg at iname.com 2006-05-09 09:59 -------
"A static array with a dimension of 0 is allowed, but no space is allocated for
it. It's useful as the last member of a variable length struct, or as the
degenerate case of a template expansion."
Still could be improved. If it's the degenerate case of a template expansion,
then you'd want the bounds checking to be still active. If OTOH you're using
it to make a variable length struct, then you'd want there to be no bounds
checking ... unless the intention is to force the programmer to write
array.ptr[42] instead of array[42]. So, are zero-length static arrays
bounds-checked or not?
--
More information about the D.gnu
mailing list