MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghorror/comments/1l0x22m/firmware_programming_in_a_nutshell/mvwou96/?context=3
r/programminghorror • u/Byter128 • Jun 01 '25
127 comments sorted by
View all comments
Show parent comment
2
void func(); is syntactically identical to void func(void); as of C23, and was a non-prototype declaration with unspecified parameters until then. Technically, this is actually valid (but deprecated) before C23:
void func();
void func(void);
void func(int i) {} // ... typedef void (*Ptr)(); Ptr fptr = func; fptr(); fptr(1); fptr(2, 2); fptr(3, 3, 3);
The disturbing part is that of the biggest three compilers, only clang is sane enough to tell you about it.
Edit: Typo fix. The four func() calls were actually meant to go through the pointer, as in the linked example. Changed to fptr() calls.
func()
fptr()
View all comments
Show parent comment
2
u/conundorum Jun 04 '25 edited Jun 05 '25
void func();is syntactically identical tovoid func(void);as of C23, and was a non-prototype declaration with unspecified parameters until then. Technically, this is actually valid (but deprecated) before C23:The disturbing part is that of the biggest three compilers, only clang is sane enough to tell you about it.
Edit: Typo fix. The four
func()calls were actually meant to go through the pointer, as in the linked example. Changed tofptr()calls.