Rendered at 02:17:15 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
bellowsgulch 3 days ago [-]
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.
bitbasher 3 days ago [-]
That doesn't make it any less interesting :)
kevin_thibedeau 33 minutes ago [-]
> f[...]
It is illegal to perform pointer arithmetic on function pointers. They are not necessarily interchangeable with data pointers. Clang is wrong.
phire 4 minutes ago [-]
In c89, there doesn't seem to be any distinction between pointer to functions and pointer to data.
However, do you know what c89 does explicitly say is undefined? Any pointer arithmetic at all (or array subscripting) for pointers are not pointing to a member of an array. It's already invalid to do pointer arithmetic a pointer to a struct.
guenthert 4 days ago [-]
"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.
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.
It is illegal to perform pointer arithmetic on function pointers. They are not necessarily interchangeable with data pointers. Clang is wrong.
However, do you know what c89 does explicitly say is undefined? Any pointer arithmetic at all (or array subscripting) for pointers are not pointing to a member of an array. It's already invalid to do pointer arithmetic a pointer to a struct.
Obsolete standard turns out to be insufficiently strict, news at 11.
That's a nice bit of understated 90s design right there