Translating C const

Jacob Carlborg doob at me.com
Sun May 27 03:10:27 PDT 2012


> That seems like a good approach, since then you're not marking things as const
> in D that C would consider mutable and therefore be likely to be altered,
> breaking D's guarantees. It does make me think that it could be valuable to
> include a comment with the original declaration though (at least in cases
> where a direct translation isn't possible). That way, it would be clearer that
> the signature in D isn't quite right. e.g.
>
> /**
>      Comment
>    */
> extern(C) void func(int*const* param);
>
> becomes something like
>
> /**
>      Comment
>    */
> extern(C) void func(int** param);
> //orig: void func(int*const* param);
>
> - Jonathan M Davis

That might be a good idea. Thanks for your feedback.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list