Re: const correctness

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
Cc: Thomas Munro <munro(at)ip9(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: const correctness
Date: 2011-11-09 15:49:04
Message-ID: 14089.1320853744@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Geoghegan <peter(at)2ndquadrant(dot)com> writes:
> On 9 November 2011 15:24, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:.
>> If you go down this road you soon start needing duplicate functions
>> for no other reason than that one takes/returns "const" and one doesn't.

> Why would you have to do that?

list_nth is an example. 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; but that
hardly satisfies anyone's idea of const cleanliness. In particular
it doesn't fix what Peter E. was on about, which was getting rid of
cast-away-const warnings, since such a function will have to do that
internally.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Cédric Villemain 2011-11-09 15:50:22 Re: a modest improvement to get_object_address()
Previous Message Kevin Grittner 2011-11-09 15:45:30 Re: const correctness