Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 09, 2015 How to translate this to D: const char *const* someConstPtr; | ||||
---|---|---|---|---|
| ||||
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 Re: How to translate this to D: const char *const* someConstPtr; | ||||
---|---|---|---|---|
| ||||
Posted in reply to ParticlePeter | 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 Re: How to translate this to D: const char *const* someConstPtr; | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | That was fast, thanks :-) |
May 09, 2015 Re: How to translate this to D: const char *const* someConstPtr; | ||||
---|---|---|---|---|
| ||||
Posted in reply to ParticlePeter | 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 |
Copyright © 1999-2021 by the D Language Foundation