Post #1907309
2026-05-02 14:47 UTC
@simontatham -- not to bother you but since this is now live you can probably kick the tires a little bit on it in Godbolt. I think it solves most of your concerns (save what happens in the default: branch!).
Still need to figure out if I need braces around the _Generic bits to see if it works.
Replies (1)
-
@simontatham@hachyderm.io 2026-05-05 11:06
@thephd that looks cool! But I transcribed the initial example from my blog post into it, added identifiers that I'd have expected to fix the compile failure, and got some very strange error messages: https://godbolt.org/z/6o77aGWE9 "'foo' declared as a pointer to a reference of type 'const char &'"? That looks like a weirdly C++ish error message for a compiler in C mode. Unless C++-style references are coming in C2y and I haven't heard? But even if that were true, it's not obvious to me how I accidentally introduced one in this code example.