digitalmars.D.learn - How to translate this to D: const char *const* someConstPtr;
- ParticlePeter (6/6) May 09 2015 Hi,
- Adam D. Ruppe (4/4) May 09 2015 The second const isn't needed in D, the first one will carry
- ParticlePeter (1/1) May 09 2015 That was fast, thanks :-)
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (16/17) May 09 2015 Disecting:
Hi, const char *const* someConstPtr; Error: no identifier for declarator char* Error: declaration expected, not '*' How would I translate this properly to d? Cheers, PP
May 09 2015
The second const isn't needed in D, the first one will carry through for it too. const char* in D is equivalent to that C declaration. const(char)* in D is what const char* in C would be.
May 09 2015
On 05/09/2015 04:18 PM, ParticlePeter wrote:const char *const* someConstPtr;Disecting: 1) const char : There are these chars that cannot be modified 2) * : There are these pointers to such const chars. 3) const: Those pointers cannot point to anything else 4) * : There are these pointers that can point to previously described pointers. The following are the D equivalents, adding more at each step: 1) const(char) 2) const(char)* 3) const(const(char)*) 4) const(const(char)*)* As Adam Ruppe said, the first const (the inner-most in the D version) is redundant: const(char*)* Ali
May 09 2015