Re:Using Zig's translate-C to understand weird C code
by rightbyte on Wednesday November 03, 2021 @07:13AM
(#29093114)
The confusing part for beginners is maybe to know were to start the spiral (or right left scheme) in a cast since there is no identifier.
[ Parent
| on HN ]
Re:Using Zig's translate-C to understand weird C code
by steerablesafe on Wednesday November 03, 2021 @08:08AM
(#29093515)
Yeah, because the "spiral-rule" is dumb, it's not a spiral at all. It's just regular operator precedence.
Re:Using Zig's translate-C to understand weird C code
by bruce343434 on Wednesday November 03, 2021 @07:16AM
(#29093138)
That's a fair point. In C, you always start at the identifier. In case there is none, type declarations can contain parentheses*, and just like in math, parens resolve first, so it's from innner to outer. So in this case one starts with the `(*)`.
* the tricky part is that `()` are also used to denote functions. So yeah, it's not always readable. `(*)()` would be a pointer to a function returning int (the default type) and taking an unspecified amount of arguments.