Re: Use func(void) for functions with no parameters

Поиск
Список
Период
Сортировка
От Bertrand Drouvot
Тема Re: Use func(void) for functions with no parameters
Дата
Msg-id aTJ9T8HyJN3D024w@ip-10-97-1-34.eu-west-3.compute.internal
обсуждение исходный текст
Ответ на Re: Use func(void) for functions with no parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On Thu, Dec 04, 2025 at 10:17:28AM -0500, Tom Lane wrote:
> Bertrand Drouvot <bertranddrouvot.pg@gmail.com> writes:
> > Yeah, what about using Pragma Directives instead, like in the
> > attached?
> 
> Yeah, a pragma is probably safer than what I was thinking about.
> But I'd be inclined to just use "#pragma GCC system_header" in
> input.h, since that's already tested and used elsewhere in the tree.

Agree.

> In any case, I don't think we should bother unless there's a push to
> enable -Wstrict-prototypes by default, which I've not heard being
> proposed.

Now that the code tree is clean, I think that this is a good timing for it.

We have been tracking and cleaning those in commits cdf4b9aff2, 0e72b9d440,
7069dbcc31, f1283ed6cc, 7b66e2c086, e95126cf04, 9f7c527af3 and recently in
9b05e2ec08a, so I think that it would make sense to "ensure" it's always tracked.

This is not just about coding style but also prevents undefined behavior (see
[1], §6.5.2.2/6). And C23 made foo() and foo(void) equivalent (see [2],
§6.7.7.4/13), so this would align with it.

If that sounds reasonable, I'd happy to work on it, thoughts?

[1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
[2]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



В списке pgsql-hackers по дате отправления: