Well, Go isn't a C replacement. Zig is more in line with that. The audience for Go largely isn't the same as the audience for C in places where C is hard to disrupt (i.e., places where a GC and runtime is unacceptable)
Yeah, although the added weirdness is that in this particular context, comma evidently takes precedence over *, so "goto *a, b, c" means "goto *(a, b, c)", rather "goto (*a), (b), (c)". Meanwhile, "x = *a, b, c" parses as "x = *a" and then two no-ops: "(x = *a), (b), (c)".
In fact, most of these have an "obvious" explanation, but then a second bottom of some sort. For example, the first one is just K&R syntax, sort of... but GCC no longer allows K&R syntax by default and will reject it with "error: old-style parameter declarations in prototyped function definition"... except if you don't name the parameter. Discovering these was... pointless fun.
scubbo | 20 hours ago
The more I find out about C, the more it makes sense that people actually like Go.
Cajunvoodoo | 14 hours ago
Well, Go isn't a C replacement. Zig is more in line with that. The audience for Go largely isn't the same as the audience for C in places where C is hard to disrupt (i.e., places where a GC and runtime is unacceptable)
viraptor | a day ago
The weird goto syntax is a computed goto as described in https://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables
[OP] lcamtuf | 23 hours ago
Yeah, although the added weirdness is that in this particular context, comma evidently takes precedence over *, so "goto *a, b, c" means "goto *(a, b, c)", rather "goto (*a), (b), (c)". Meanwhile, "x = *a, b, c" parses as "x = *a" and then two no-ops: "(x = *a), (b), (c)".
In fact, most of these have an "obvious" explanation, but then a second bottom of some sort. For example, the first one is just K&R syntax, sort of... but GCC no longer allows K&R syntax by default and will reject it with "error: old-style parameter declarations in prototyped function definition"... except if you don't name the parameter. Discovering these was... pointless fun.
viraptor | 22 hours ago
No, this is art! :)
lemon | 14 hours ago
Another fun example that is non standard but accepted by tcc:
Combine with K&R declarations for more silliness:
https://godbolt.org/z/5c5vr7veE