Re: const correctness
| От | Tom Lane |
|---|---|
| Тема | Re: const correctness |
| Дата | |
| Msg-id | 13350.1320955831@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: const correctness ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>) |
| Ответы |
Re: const correctness
|
| Список | 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 по дате отправления: