delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/30/16:36:33

From: naisbodo <naisbodo AT enteract DOT com>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: what's this mean?
Date: 30 Nov 2000 21:34:41 GMT
Organization: http://www.naisbodo.com/
Lines: 42
Distribution: world
Message-ID: <906h5h$ih$5@bob.news.rcn.net>
References: <3a267c5f DOT 0 AT news DOT syr DOT edu> <906dla$lj3$1 AT news5 DOT isdnet DOT net> <cpgd2tsc745qd362mat6pllg8spunmkch2 AT 4ax DOT com>
X-Trace: IRiY7kSqEWD3/itvFF4BTfJFH7SjoGofTCcUGaSWFCU=
X-Complaints-To: abuse AT rcn DOT com
NNTP-Posting-Date: 30 Nov 2000 21:34:41 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019