Re: [HACKERS] Adding some const keywords to external interfaces

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Adding some const keywords to external interfaces
Дата
Msg-id 15310.918187905@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Adding some const keywords to external interfaces  (Bruce Momjian <maillist@candle.pha.pa.us>)
Ответы Re: [HACKERS] Adding some const keywords to external interfaces  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Um, I hate to say "I told you so", but this const-addition has
in fact created more warning messages than it eliminated:

gcc -I../../interfaces/libpq -I../../include -I../../backend   -g -O -Wall -Wmissing-prototypes   -c psql.c -o psql.o
psql.c: In function `HandleSlashCmds':
psql.c:1833: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2192: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2257: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2265: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c:2309: warning: passing arg 1 of `free' discards `const' from pointer target type
psql.c: In function `main':
psql.c:2982: warning: passing arg 1 of `free' discards `const' from pointer target type

I think this is a fairly graphic demonstration of my assertion that
adding const to application-visible fields is not entirely transparent.

I would like to back this patch out until such time as we are prepared
to fully const-ify libpq's interface (eg, declare PQgetvalue and all
the other accessor functions as returning const char* not just char*).
We shouldn't annoy application programmers a little bit here and a
little bit there --- we should go the whole nine yards at once rather
than forcing them to insert a few more "const"s with each release.
IMHO, anyway.
        regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] DEC OSF1 Compilation problems
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Adding some const keywords to external interfaces