Re: A couple items on TODO
Peter Eisentraut <peter_e@gmx.net>
From: Peter Eisentraut <peter_e@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christopher Kings-Lynne <chriskl@familyhealth.com.au>, Bruce Momjian <pgman@candle.pha.pa.us>, Jeff Davis <list-pgsql-hackers@dynworks.com>, <pgsql-hackers@postgresql.org>
Date: 2001-08-24T14:24:27Z
Lists: pgsql-hackers
Tom Lane writes: > Yeah, people have started to use 'const' in new code, but the older > stuff doesn't use it, which means that the net effect is probably > more annoyance than help. I'm afraid that if we attack this in an > incremental way, we'll end up with code that may have a lot of const > markers in the declarations, but the actual code is riddled with > explicit casts to remove const because at one time or another that > was necessary in a particular place. > > Can anyone think of a way to get from here to there without either > a lot of leftover cruft, or a "big bang" massive changeover? What I usually do if I feel a parameter could be made const is to propagate the change as far as necessary to the underlying functions. >From time to time this turns out to be impossible at some layer. BUT: This is an indicator that you really don't know whether the value is const so you shouldn't declare it thus. IMHO, a better project than putting const qualifiers all over interfaces that you are not familiar with would be to clean up all the -Wcast-qual warnings. -- Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter