| From: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Use func(void) for functions with no parameters |
| Date: | 2025-12-03 15:02:17 |
| Message-ID: | CAEze2WiT7xaGGgo1qCTZZKJASWr_jNEsOnb5EXgEOusSELMXRw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 3 Dec 2025 at 15:51, Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2025-12-03 15:02:44 | Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM |
| Previous Message | Bertrand Drouvot | 2025-12-03 14:51:25 | Use func(void) for functions with no parameters |