Bart <[email protected]> writes:
On 26/03/2026 23:12, Keith Thompson wrote:
[...]
(Unless you're using a C23 compiler, I suggest "int F(void)" rather
than "int F()".)
Nobody bothers with that any more.
I presume that's meant to be hyperbole. Plenty of C programmers do
bother with that.
Most seem to assume that () already
means zero parameters anyway, judging by the incorrect usage I
constantly saw in open source code.
I find it better to write correct code than to look for excuses
to write poor code. If I define a parameterless function F, I
absolutely want a diagnostic if I call it with one or more arguments.
If nothing else, it's an opportunity to set a good example.
Keith Thompson <[email protected]> writes:
Bart <[email protected]> writes:
On 26/03/2026 23:12, Keith Thompson wrote:[...]
(Unless you're using a C23 compiler, I suggest "int F(void)" rather
than "int F()".)
Nobody bothers with that any more.
I presume that's meant to be hyperbole. Plenty of C programmers do
bother with that.
Most seem to assume that () already
means zero parameters anyway, judging by the incorrect usage I
constantly saw in open source code.
I find it better to write correct code than to look for excuses
to write poor code. If I define a parameterless function F, I
absolutely want a diagnostic if I call it with one or more arguments.
If nothing else, it's an opportunity to set a good example.
The declaration "int F();" is correct code. Just because you
don't like it doesn't mean it's wrong.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,114 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 492515:55:02 |
| Calls: | 14,267 |
| Calls today: | 3 |
| Files: | 186,321 |
| D/L today: |
27,599 files (9,006M bytes) |
| Messages: | 2,518,520 |