Re: Are we missing (void) when return value of fsm_set_and_search is ignored? - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Are we missing (void) when return value of fsm_set_and_search is ignored?
Date
Msg-id CALj2ACW8tM+5W50NzHj3xbawiO9B4Qusw7SyGU5Npc+cXbOx7w@mail.gmail.com
Whole thread Raw
In response to Re: Are we missing (void) when return value of fsm_set_and_search is ignored?  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List pgsql-hackers
On Sat, Jun 5, 2021 at 1:38 AM Peter Eisentraut
<peter.eisentraut@enterprisedb.com> wrote:
>
> On 04.06.21 06:28, Julien Rouhaud wrote:
> > Yes, but we have a lot a examples of functions without pg_nodiscard and callers
> > still explicitly ignoring the results, like fsm_vacuum_page() in the same file.
> > It would be more consistent and make the code slightly more self explanatory.
>
> I'm not clear how you'd make a guideline out of this, other than, "it's
> also done elsewhere".

I proposed to do (void) fsm_set_and_search by looking at lot of other
places (more than few 100) in the code base like (void)
defGetBoolean(def) (void) hv_iterinit(obj) (void) set_config_option(
and so on. I'm not sure whether having consistent code in a few
hundred places amounts to a standard practice.

> In this case I'd actually split the function in two, one that returns
> void and one that always returns a value to be consumed.  This
> overloading is a bit confusing.

Thanks. I don't want to go in that direction. Instead I choose to
withdraw the proposal here and let the fsm_set_and_search function
usage be as is.

With Regards,
Bharath Rupireddy.



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Python 3.10 breaks regression tests with traceback changes
Next
From: Bharath Rupireddy
Date:
Subject: Re: A new function to wait for the backend exit after termination