4 ms·
I think that's draw of the luck with 0xdeadbeef vs 0x0. I had a case once were it would have made no difference, and I discovered it when there was no initializ
by archi42 4y ago
I think that's draw of the luck with 0xdeadbeef vs 0x0. I had a case once were it would have made no difference, and I discovered it when there was no initialization in another platform, and all of a sudden we got random results for some old benchmark.
"Not accidentally correct" seems difficult in the generic case (think a 1 bit flag; of course for an int 0 is likely "more expected" than any other value); NaN for floats however is a nice variant that should work pretty well. Is it signaling or quiet?
- WalterBright 4y ago> difficult in the generic case We do what we can. D also uses 0xFF for char default initialization (an invalid code unit).
- archi42 4y agoYeah, there is only so much that's possible on the language side. Though static analysis in compilers can catch some instances of some problems. But looking up your name, I guess you probably already knew that :) I'd love to see hardware having a "offloaded memory guard" flag: Mark in-use memory with it and get a OMG trap on any memory access with the flag not set (of course totally transparent with hardware acceleration). Too bad this is only simple on paper, where there is no such thing as (among others) memory latency.