C const

Bekenn leaveme at alone.com
Sat Mar 5 10:58:30 PST 2011


On 3/4/2011 11:19 AM, simendsjo wrote:
> It also says "char const* q". Is "const char*" the same thing in C?

For reference:

In C, const T* x is the same as T const* x; both declare a mutable 
pointer to const T.  T* const x declares a const pointer to mutable T, 
for which D has no analogue.

In D, const T* x declares a const pointer to const T, which differs from 
the C syntax.  In C, that would be const T* const x (or T const * const 
x).  Thank God for D.


More information about the Digitalmars-d-learn mailing list