3 ms·
Yes, but unlike C's terribly confusing "declaration follows usage" style, which no tells you about btw, zig's pointer syntax doesn’t turn into a nightmarish puz
by cassepipe 2y ago
Yes, but unlike C's terribly confusing "declaration follows usage" style, which no tells you about btw, zig's pointer syntax doesn’t turn into a nightmarish puzzle.
In Zig, you can pretty much read the types aloud and it makes, your brain does not need to peek for parsing.
For me it's too late, I got used to the C way but I still want the better thing to get adopted.
No more int ((foo)(int))[5]; nonsense—just T, [N]T, or *T, making intent crystal clear.
- toasterlovin 2y ago> Yes, but unlike C's terribly confusing "declaration follows usage" style, which no tells you about btw I happen to be reading the K&R C book right now and they do in fact tell you this.
- ajross 2y agoYeah, not sure where that came from. The ANSI C standard was extensively documented in books and articles and specs at all levels of rigor starting from the mid-80's. No one has ever lacked for a reference for how function pointer declaration looks. That said, C's function pointer declaration syntax is indeed awful. But really that's because ANSI took a very hardline "no incompatible changes" tact when adding prototypes to the language, which limited the ways they could express them. That decision is one of the reasons we're still writing C today. Any yahoo can come up with a new language, kids do it all the time. ANSI's job was to add features to the language in which Unix was already written.
- cassepipe 2y agoWell it's been lost on every C online tutorial I guess I have not read it so that's on me I guess