Re: const correctness

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: const correctness
Дата
Msg-id 4EBBD85C0200002500042CEE@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: const correctness  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: const correctness  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> wrote:
> On ons, 2011-11-09 at 10:49 -0500, Tom Lane wrote:
>> Now admittedly you can hack it, in the same
>> spirit as the C library functions that are declared to take const
>> pointers and return non-const pointers to the very same data 
> 
> Which C library functions do that?
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.
-Kevin


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: -Wcast-qual cleanup, part 1
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: foreign key locks, 2nd attempt