CDB الأساسية: هل تختلف CDB كيف تؤثر النطاق؟

StackOverflow https://stackoverflow.com/questions/6048602

  •  15-11-2019
  •  | 
  •  

سؤال

إذا قمت بتجميعها: giveacodicetagpre.

ثم تفكيك الرئيسية في CDB أحصل على: giveacodicetagpre.

حتى * a يرمز عن طريق المؤشرات!كل شيء جيد.

ومع ذلك، إذا أعلنت المؤشر داخل الرئيسية: giveacodicetagpre.

أرى أن A مجرد إزاحة من مؤشر المكدس (أؤمن)، بل هي هيكل مقروء الإنسان الذي أتوقعه (مثل، يقول المؤشرات! الرئيسية! أ): giveacodicetagpre.

ربما هذا هو ما يتعلق بفهم ما الذي قام به المحول البرمجي مثل أي شيء آخر ولكن: هل يمكن لأي شخص أن يفسر سبب عدم وجود تدوين أليس ما أتوقعه؟

(هذا مستوحى من التأمل أثناء النظر في تصحيح ويندوز X64: أسس عملية من Dmitry Vostokov).

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

المحلول

When a variable is defined inside a function, it is an automatic variable unless explicitly declared static. Such variables only live during the execution of the function and are normally allocated in the stack, thus they are deallocated when the function exits. The change you see in the complied code is not due to the change in scope but to the change from static to automatic variable. If you make a static, it will not be allocated in the stack, even if its scope is the function main.

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