typedef FileName not const?

Started by Mark Dilgerover 9 years ago3 messageshackers
Jump to latest
#1Mark Dilger
mark.dilger@enterprisedb.com

Friends,

along the lines of other similar emails from me of late,
I tried to avoid casting away const when using the FileName
typedef. There are several calls where a (const char *) has to
be cast to (char *) due to FileName being typedef'd as
non-const. But changing the typedef to const doesn't seem to
conflict with any code in the source tree.

Since this may be seen as an external API change, I kept
these changes in their own patch submission, so that it can
be rejected separately if need be.

Mark Dilger

Attachments:

filename.patch.1application/octet-stream; name=filename.patch.1Download+6-6
#2Andres Freund
andres@anarazel.de
In reply to: Mark Dilger (#1)
Re: typedef FileName not const?

Hi,

Can we please keep this topic in one thread? Anybody motivated to apply
these isn't going to have an easy time applying things, and everyone
else is just having a harder time sorting through the mails.

On 2016-09-27 17:08:24 -0700, Mark Dilger wrote:

along the lines of other similar emails from me of late,
I tried to avoid casting away const when using the FileName
typedef. There are several calls where a (const char *) has to
be cast to (char *) due to FileName being typedef'd as
non-const. But changing the typedef to const doesn't seem to
conflict with any code in the source tree.

I think the better fix here is to simply remove the typedef. It doesn't
seem to have much of a benefit, and makes using correct types harder as
demonstrated here. We don't even use it internally in fd.c..

Andres

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Mark Dilger
mark.dilger@enterprisedb.com
In reply to: Andres Freund (#2)
Re: typedef FileName not const?

I think the better fix here is to simply remove the typedef. It doesn't
seem to have much of a benefit, and makes using correct types harder as
demonstrated here. We don't even use it internally in fd.c..

Fine by me.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers