Hacker News new | ask | show | jobs
by Lvl999Noob 1597 days ago
Is initializing a NonZero field to 0 really initializing it?
2 comments

no not at all

IMHO requiring all types in C to have a valid "all zero" variant so that this pattern can be used isn't grate either, somewhat of an anti-pattern even. But an anti-pattern needed for ergonomic C.

The post is a good example for trying to program "like in a different language" just because some tools somewhat allow it. Like in this case "programming rust like it's C".

And if you do rust FFI and have a lot of C experience it is tempting.

Sort of. It's definitely better than not initializing it.