4 ms·
Playing devil's advocate: local variables declared but not initialized before being used will always generate a warning (which can be turned into a hard error)
by cesarb 11y ago
Playing devil's advocate: local variables declared but not initialized before being used will always generate a warning (which can be turned into a hard error) on modern optimizing compilers like gcc or clang.
And having all variables declared at the top of the function can make it easier to visualize how much stack space the function is using, which can be useful when your stack is limited to a few kilobytes.