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

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: darcy(at)druid(dot)net (D'ArcyJ(dot)M(dot)Cain)
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, darcy(at)druid(dot)net, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Adding some const keywords to external interfaces
Date: 1999-01-24 04:33:01
Message-ID: 199901240433.XAA17946@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Actually, all the changes should be internal to our own code. Functions
> that take const char pointers can still send non-const pointers. The
> errors would be generated if we changed the return value of the library
> functions, not the arguments.
>
> Not that I don't think that return values should be changed where it
> is appropriate as well but this change doesn't do that.
>
...
> > if we want to take const-safety seriously the effects will ripple
> > throughout the code...
>
> I would love to see const-safety given more attention but certainly
> we should make sure our external interfaces are correct so that people
> writing to them have the opportunity to do full error checking.

These are good points. Can you post the patch again? I deleted it.
Sounds like it would be safe. I am interested in const-ify-ing the
backend code, if possible. It does offer a level of code checking that
we don't currently have.

The only issue is that is has to be done pretty exhaustively. If you
don't, your new const function parameters start passing params to
functions that takes non-const params, and warnings start to fly.

--
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 1999-01-24 05:29:51 Re: [HACKERS] Postgres Speed or lack thereof
Previous Message D'Arcy J.M. Cain 1999-01-24 03:42:39 Re: [HACKERS] Adding some const keywords to external interfaces