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

Поиск
Список
Период
Сортировка
От Matthias van de Meent
Тема Re: Use func(void) for functions with no parameters
Дата
Msg-id CAEze2WiT7xaGGgo1qCTZZKJASWr_jNEsOnb5EXgEOusSELMXRw@mail.gmail.com
обсуждение исходный текст
Ответ на Use func(void) for functions with no parameters  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Ответы Re: Use func(void) for functions with no parameters
Список pgsql-hackers
On Wed, 3 Dec 2025 at 15:51, Bertrand Drouvot
<bertranddrouvot.pg@gmail.com> wrote:
>
> Hi hackers,
>
> In C standards till C17, func() means "unspecified parameters" while func(void)
> means "no parameters". The former disables compile time type checking and was
> marked obsolescent in C99 ([1]).
>
> This patch replaces empty parameter lists with explicit void to enable proper
> type checking and eliminate possible undefined behavior (see [1]) if the function
> is called with parameters. This also prevents real bugs (API misuse for example).

LGTM, thanks!

I noticed the only changes here are for `static` definitions. Are we
just more careful with normal functions, or does the compiler complain
more easily about such "incomplete" definitions when they're in
headers or need to be linked against?


Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)



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