Re: gratuitous casting away const

From: Mark Dilger <hornschnorter(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: gratuitous casting away const
Date: 2016-09-22 17:53:49
Message-ID: D4C960EA-8D13-4739-B7EF-FE6B6B76FE8B@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> On Sep 22, 2016, at 9:14 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> I'd call this kind of a wash, I guess. I'd be more excited about it if
> the change allowed removal of an actual cast-away-of-constness somewhere.
>
> I suppose it's a bit of a chicken and egg situation, in that the lack
> of const markings on leaf subroutines discourages use of "const" in
> callers, and you have to start somewhere if you want to make it better.
> But I don't really want to just plaster "const" onto individual functions
> without some larger vision of where we're going and which code is going
> to benefit. Otherwise it seems like mostly just code churn.
>
> regards, tom lane

I have two purposes in doing this. First, I find the code more self-documenting
this way. Second, I can get whole directories to compile cleanly without
warnings using the -Wcast-qual flag, where currently that flag results in
warnings. That makes it possible to add cast-qual to more individual source
directories' Makefiles than I can currently do while still using -Werror in
Makefile.global.

Now, I'm not proposing that everybody else needs to have -Wcast-qual. I'm
just saying that I'd like to be able to have that in my copy of the project.

mark

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-09-22 18:34:59 Re: Use of SizeOfIptrData - is that obsolete?
Previous Message Michael Banck 2016-09-22 17:37:54 Re: Exclude schema during pg_restore