Mail Archives: djgpp/2000/11/30/16:36:33
In comp.lang.c Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comremovebullcr_p> wrote:
> On Thu, 30 Nov 2000 21:34:43 +0100, "-hs-"
> <email DOT invalid AT server DOT invalid> wrote:
>
>>void mem_err(char const *, char const *)
>
> YM const char *.
No, -hs- is correct.
> IIRC
IAAYDNRC.
> with char const *, it's the pointer that's constant, not the value the
> pointer references. With const char *, the pointer can change (using
> ++ and -- to move around in the vector), but nothing can be modified
> through the pointer.
Consider:
char const * identifier1;
const char * identifier2;
char * const identifier3;
identifier1 = identifier2; /* works */
identifier2 = identifier1; /* works */
identifier3 = identifier1; /* error! */
The first two are equally qualified. The third, however, cannot be
assigned to, because the pointer is constant. This is the distinction
you meant to make, I'm sure. Additionally, one can say:
const char * const identifier4;
char const * const identifier5;
These last two are equivalent, as well.
--
naisbodo AT enteract DOT com
http://www.naisbodo.com/
- Raw text -