News for hackers. Stuff that matters.
Re:Zig's dot star syntax (value.*) by throwawaymaths on Sunday March 09, 2025 @09:51AM (#43309061)
this is not just a preference but a practical matter, esp. for reading nd checking other People's code. did you solve the puzzle at the end with high confidence?
Re:Zig's dot star syntax (value.*) by wat10000 on Sunday March 09, 2025 @11:51AM (#43310218)
You mean `foo = *bar[10]`? That’s equivalent to `bar[10][0][0]`, i.e. the array element access is done first, then the retrieved element is dereferenced twice. I’m quite confident in this, but I’m a systems programmer working in C++, so that’s my bread and butter.
Re:Zig's dot star syntax (value.*) by throwawaymaths on Sunday March 09, 2025 @01:37PM (#43311540)
it's hard to disambiguate from bar[0][0][10]...
Re:Zig's dot star syntax (value.*) by wat10000 on Sunday March 09, 2025 @05:15PM (#43313925)
Sure, I see your point and suffix does seem like the better option. But for people who do a lot of C, it’s not an issue.