Idea: Introduce zero-terminated string specifier

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Oct 1 11:50:09 PDT 2012


On 10/1/12, Piotr Szturmaj <bncrbme at jadamspam.pl> wrote:
> For example C binding writers may change:
>
> extern(C) char* getstr();
>
> to
>
> extern(C) cstring getstr();

I don't think you can reliably do that because of semantics w.r.t.
passing parameters on the stack vs in registers based on whether a
type is a pointer or not. I've had this sort of bug when wrapping C++
where the C++ compiler was passing a parameter in one way but the D
compiler expected the parameters to be passed, simply because I tried
to be clever and fake a return type. See:
http://forum.dlang.org/thread/mailman.1547.1346632732.31962.d.gnu@puremagic.com#post-mailman.1557.1346690320.31962.d.gnu:40puremagic.com


More information about the Digitalmars-d mailing list