Translating C const

Ali Çehreli acehreli at yahoo.com
Tue May 15 12:50:42 PDT 2012


On 05/15/2012 12:36 PM, Jacob Carlborg wrote:
> I'm trying to figuring out how to translate const in C to D. I have
> these examples:
>
> const int * a;
> int * const b;
> const int * const c;
> const int * const * d;
>
> Which I think should be translated like this:
>
> const(int)* a;
> const int* c;
> const(int*)* d;
>
> But I don't know how to translate "b". I think "b" is a const pointer to
> a mutable int, is that possible to have in D?
>

Not possible in D. D's const is transitive. If b is const, then what it 
points to is also const.

Ali

-- 
D Programming Language Tutorial: http://ddili.org/ders/d.en/index.html


More information about the Digitalmars-d-learn mailing list