4 ms·
you can find all the stack variables easily You can't do that unless you look at the assembly output. While there may have once been a time in history where "
by colanderman 14y ago
you can find all the stack variables easily
You can't do that unless you look at the assembly output. While there may have once been a time in history where "locally-scoped variable == entry on stack", those days are long gone. Any decently smart compiler (i.e. GCC and LLVM) will use registers in preference to the stack, and will collapse local variables whose lifetimes do not overlap into a single storage location.
- alanctgardner2 14y agoMy bad, I meant locally scoped, I tend to think in terms of "it's on the stack (or a register), or it's on the heap (because it's been malloc'd and needs to be freed)". I do need to review my terminology...