Re: [HACKERS] Adding some const keywords to external interfaces
От | Bruce Momjian |
---|---|
Тема | Re: [HACKERS] Adding some const keywords to external interfaces |
Дата | |
Msg-id | 199902050426.XAA26440@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: [HACKERS] Adding some const keywords to external interfaces (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
I see the problem here too. Reversing it now out. D'Arcy, do you care to comment? > 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 > -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
В списке pgsql-hackers по дате отправления: