On Mon, Nov 7, 2011 at 12:13 AM, Peter Eisentraut <pete...@gmx.net> wrote: > Anyway, attached is the first patch for your amusement.
I can't help but wonder if the cure isn't worse than the disease. I mean, I very much like the fact that our code compiles without warnings, and I'm glad you're willing to put in the time to make that happen ... but aren't these warnings incredibly pedantic? const is like kudzu. Once you start using it, you find that you need it everywhere ... but your life is no better than it was before, except that now you have const. I'm suspicious of this hunk, for example: typedef struct ErrorContextCallback { struct ErrorContextCallback *previous; - void (*callback) (void *arg); - void *arg; + void (*callback) (const void *arg); + const void *arg; } ErrorContextCallback; Why should the callback be forced to treat its private argument as const? #define XLogRecGetData(record) ((char*) (record) + SizeOfXLogRecord) +#define XLogRecGetConstData(record) ((const char*) (record) + SizeOfXLogRecord) IMHO, this is an example of everything that's wrong with const. The result will, I suppose, be const if and only if record is const. But there's no way to express that cleanly, so we have to duplicate the macro definition. And anyone who is not using the right compiler version will have to stare at the code and scratch their head to figure out which one to use. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers