Re: const correctness - Mailing list pgsql-hackers

From Tom Lane
Subject Re: const correctness
Date
Msg-id 14089.1320853744@sss.pgh.pa.us
Whole thread Raw
In response to const correctness  (Thomas Munro <munro@ip9.org>)
Responses Re: const correctness
List pgsql-hackers
Peter Geoghegan <peter@2ndquadrant.com> writes:
> On 9 November 2011 15:24, Tom Lane <tgl@sss.pgh.pa.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


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: const correctness
Next
From: Cédric Villemain
Date:
Subject: Re: a modest improvement to get_object_address()