C89's Undefined Behavior: GCC and Clang Disagree on a 30-Year-Old Ambiguity
An ambiguity in c89 which will never be fixed
A C89 standard ambiguity regarding implicit function declarations remains unresolved, as GCC and Clang interpret the 'innermost block' phrase differently. The issue arises in code like `int f(int f[sizeof(f())]);`, where the implicit declaration of `f` may land in function prototype scope, causing a redeclaration conflict. Clang accepts the code, while GCC rejects it, and the standard's silence on the matter means the behavior will never be clarified since C99 removed the feature.
i am begging people to stop using c89. please.
- bellowsgulch
All the weird stuff I have read about C or C++ doing over the years could be summed up with “Well… don’t do that.”
Like almost without fail. I can’t even think of how you’d end up in a scenario like this because a compiler would complain before letting you use an undefined implicit declaration.
- kevin_thibedeau
> f[...]
It is illegal to perform pointer arithmetic on function pointers. They are not necessarily interchangeable with data pointers. Clang is wrong.
- guenthert
"because the problematic behavior was removed from the standard over 27 years ago, we'll never have closure on what the intended interpretation is."
Obsolete standard turns out to be insufficiently strict, news at 11.