3 ms·
Forcing declares at the top makes it easy to estimate at a glance (or exactly calculate) how much space the stack frame will use.
by foobarbaz33 3y ago
Forcing declares at the top makes it easy to estimate at a glance (or exactly calculate) how much space the stack frame will use.
- dezgeg 3y agoMaybe in the early days of C, but with modern compilers doing stuff like keeping variables in only registers, inlining functions, stack cookies, merging non overlapping variables etc. that seems not really worth it. If you want to avoid accidental huge stack usage you can pass flag to gcc/clang to trigger warning when stack usage of a function goes over the specified limit.