Idea: Introduce zero-terminated string specifier

Piotr Szturmaj bncrbme at jadamspam.pl
Tue Oct 2 01:16:57 PDT 2012


Andrej Mitrovic wrote:
> 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

I think that align(1) structs that wrap a single value should be treated 
as its type. After all they have the same size and representation. I 
don't know how this works now, though.


More information about the Digitalmars-d mailing list