Signed word lengths and indexes
Adam Ruppe
destructionator at gmail.com
Fri Jun 18 17:36:06 PDT 2010
On 6/18/10, bearophile <bearophileHUGS at lycos.com> wrote:
> By the way, this program shows your code is not a replacement of the
> operator overloading of the variable length struct itself I was talking
> about, because D structs can't have length zero (plus 3 bytes of padding,
> here):
Huh, weird. Doesn't make too much of a difference in practice though,
since it only changes the malloc line slightly.
In C, before the array[0] was allowed (actually, I'm not completely
sure it is allowed even now in the standard. C99 added something, but
I don't recall if it is the same thing), people would use array[1].
Since it is at the tail of the struct, and you're using pointer magic
to the raw memory anyway, it doesn't make much of a difference.
More information about the Digitalmars-d
mailing list