سؤال

Why are static variables addressed directly while locals are addressed indirectly? I cannot see where the indirection comes from for locals!

هل كانت مفيدة؟

المحلول

In languages that allow functions to be used recursively, locals need to be addressed indirectly (via the stack pointer).

C, however, has also static local variables, hence static and local are not necessarily mutually exclusive concepts.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top