On 05/05/18 10:48, G. Branden Robinson wrote:
> (Incidentally, I share your preference for putting type qualifiers
> [as opposed to storage classes] _after_ the type name itself.  It
> makes complex declarations easier to understand.)

Personally, I consider that to be a poor choice ... especially if you
are making it on purely stylistic grounds; conventionally:

  const int foo;

is more common than:

  int const foo;

but that's not the real issue.  In practice, the placement of "const"
qualifiers is *not* arbitrary; far from "making the declaration easier
to understand", it can effect a subtle change in meaning.  For example,
in C code, it is very common to see:

  const char *foo;

which means something very different from:

  char const *foo;

Your stylistic preference might encourage the latter idiom, but it
likely isn't what you meant.  (The former declares a mutable pointer to
an immutable C-string; the latter is an immutable pointer to a mutable
C-string).

-- 
Regards, Keith.



Reply via email to