Passing ref T[n] to C
bearophile
bearophileHUGS at lycos.com
Mon Dec 9 08:09:45 PST 2013
Mike Parker:
> I was expecting the length field to get in the way, but it
> didn't seem to.
If you pass a fixed-sized array by ref it only passes the
pointer. The length is not passed, it's a compile-time known
value.
> My question is, can I rely on this? Is there a guarantee that a
> ref static array parameter will be compatible with a C array
> pointer on every platform and architecture?
While the semantics of "ref" if fixed, I don't remember if the
standard D ABI specifies how "fixed-sized array by ref" is
implemented.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list