Re: warnings for invalid function casts

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: warnings for invalid function casts
Date: 2020-07-07 09:45:41
Message-ID: 2410175f-255d-ab5c-e95e-2dfc1bad3f97@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-07-04 16:16, Tom Lane wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
>> Do people prefer a typedef or just writing it out, like it's done in the
>> Python code?
>
> I'm for a typedef. There is *nothing* readable about "(void (*) (void))",
> and the fact that it's theoretically incorrect for the purpose doesn't
> exactly aid intelligibility either. With a typedef, not only are
> the uses more readable but there's a place to put a comment explaining
> that this is notionally wrong but it's what gcc specifies to use
> to suppress thus-and-such warnings.

Makes sense. New patch here.

>> But if we prefer a typedef then I'd propose
>> GenericFuncPtr like in the initial patch.
>
> That name is OK by me.

I changed that to pg_funcptr_t, to look a bit more like C and less like
Java. ;-)

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v3-0001-Fix-Wcast-function-type-warnings.patch text/plain 11.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-07-07 09:50:26 Re: Default setting for enable_hashagg_disk (hash_mem)
Previous Message Michael Paquier 2020-07-07 09:36:10 Re: Quick doc patch