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

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: darcy(at)druid(dot)net, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Adding some const keywords to external interfaces
Date: 1999-02-05 04:26:36
Message-ID: 199902050426.XAA26440@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-02-05 04:53:37 SELECT INTO TABLE busted?
Previous Message Tom Lane 1999-02-05 04:11:45 Re: [HACKERS] Adding some const keywords to external interfaces