How to translate this to D: const char *const* someConstPtr;

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 9 16:41:31 PDT 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



More information about the Digitalmars-d-learn mailing list