3 ms·
Exactly. A compiler cannot guess what a programmer intended, but has to stick to the language semantics. Also, the article goes on to argue that uninitialized
by sddfd 9y ago
Exactly. A compiler cannot guess what a programmer intended, but has to stick to the language semantics.
Also, the article goes on to argue that uninitialized memory is used to seed random generators, which is generally undefined behavior. I don't think this should be a valid use-case.
- deleted 9y ago[deleted]
- GedByrne 9y agoSo go use rust and leave C for those who think it should.
- JCzynski 9y agoI will communicate cryptographically with people using C, so no.
- andreareina 9y agoThat business about uninitialized values being used to seed RNGs threw me for a loop as well. I think it's safe to say that x ^= x is equivalent to x = 0 and optimize it that way, just like compilers recognize common idioms for e.g. swapping, counting set bits, etc and emit the correct intrinsic instructions.