3 ms·
zig has many of the same footguns as C++ and C; it just has better developer ergonomics. Use after free, double free, invalid stack RW, uninitialized data, rac
by dleslie 5y ago
zig has many of the same footguns as C++ and C; it just has better developer ergonomics.
Use after free, double free, invalid stack RW, uninitialized data, race conditions, etc. They're all possible to be found in Zig programs, because the language doesn't provide assurances against them.
- remexre 5y ago(Have never written Zig) Does the design of the language make them less (or more) likely to occur, though? e.g. all these things are possible in Forth too, but the design of the language definitely seems to conspire to make them less likely than C in my experience (I probably have about as many hours in each now? Roughly 1k, maybe 1.5k?). (I suspect that this is the case in Forth because the stack gives a "linear-like feel" to most code; it's more obvious that you're accidentally not freeing something, because you need to explicitly discard it.)
- dleslie 5y agoThe design doesn't do anything particularly different or cumbersome regarding memory and ownership, so I'll hazard a guess and say no, it doesn't make it less likely.