Two ways of receiving arrays on the C ABI

Jacob Carlborg doob at me.com
Sun Oct 25 12:15:06 UTC 2020


On 2020-10-20 02:16, Ali Çehreli wrote:

> Everything works at least on Linux. Is this kosher, or am I using some 
> internal knowledge?

Yes, you're using some internal knowledge. You cannot assume it works on 
any other platform or architecture. In theory, the D compiler could 
choose to change the ABI for passing D arrays and this would break. If 
fact, the ABI documentation [1] doesn't mention how a D array is passed. 
A different compiler could choose to pass it differently.

[1] https://dlang.org/spec/abi.html#arrays

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list