Frage

wenn ich kompiliere: generasacodicetagpre.

und dann den Hauptmontieren in CDB-I-Erhalten: generasacodicetagpre.

so * a wird von Zeigerprojekt symbolisiert! A.Alles gut.

Wenn ich jedoch den Zeiger innerhalb der Main erklären: generasacodicetagpre.

Ich sehe, dass A nur ein Versatz vom Stapelzeiger (ich glaube), eher als die menschenlesbare Struktur, die ich erwarten würde (wie z. B. Pointersproject! Haupt! A): generasacodicetagpre.

Dies ist wahrscheinlich so viel über mein Verständnis dafür, was der Compiler so etwas anderes als alles andere als alles andere als: Kann jemand erklären, warum die Notation für A nicht das nicht erwartet?

(dies inspiriert, inspiriert, wenn er X64 Windows-Debugging angeht: Praktische Grundlagen von Dmitry Vostookov).

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top