3 ms·
I've found NaN initialization for floats to be a useful default (like undefined in Javascript) since it propagates. Integer have no NaNs, so they are initializ
by p0nce 11y ago
I've found NaN initialization for floats to be a useful default (like undefined in Javascript) since it propagates.
Integer have no NaNs, so they are initialized with 0s since no other value really fits.
I don't know for chars but I guess there are good reasons as well.
- qznc 11y agoI can confirm that. Found at least one bug due to NaN initialization, which would otherwise probably have silently corrupted my data without me noticing. When I found the reason source of the NaNs in my data it was a Neo-like Whoaaa feeling. Unfortunately, I cannot remember the details of the code, so only anecdotal evidence. ;)