Re: const correctness - Mailing list pgsql-hackers

From Tom Lane
Subject Re: const correctness
Date
Msg-id 13350.1320955831@sss.pgh.pa.us
Whole thread Raw
In response to Re: const correctness  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: const correctness
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Tom mentioned the strchr() function, which does do that.  I don't
> actually find that surprising given my understanding of the
> semantics.  That means that the function is promising not to modify
> the character array, but is not asserting that it knows the
> character array to be immutable.  Makes sense to me.  It's up to the
> caller to assign it to a "const char *" if it knows it passed in an
> immutable object.
The problem with it of course is that mistaken use could have the
effect of casting-away-const, which is exactly what we hoped to prevent.
Still, there may not be a better solution.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump 9.1.1 hanging (collectSecLabels gets 0 labels)
Next
From: Peter Eisentraut
Date:
Subject: Re: pl/python custom datatype parsers