const char* or const(char)* when porting C headers?

Alexandr Druzhinin drug2004 at bk.ru
Sun Dec 22 22:29:52 PST 2013


22.12.2013 11:06, Alexandr Druzhinin пишет:
> 22.12.2013 07:47, Gary Willoughby пишет:
>> When porting C headers which include function declarations with using
>> char* types. Is it best to use const char* or const(char)* as the type
>> in the D declaration?
> C vs D
> const char* == const(char)*
> const char const* == const char*
Yes, the last line should be
const char * const == const char*
thanks to Benjamin

IIRC in D qualificator is applied to the right part of statement if 
there is no the parantheses and to part inside the parantheses if they 
exists. Important thing is that in D qualificators are transitive. It 
makes type system more robust (from POV immutability), but doesn't 
complete it, sadly.


More information about the Digitalmars-d-learn mailing list