Help me ! Question for variables in stack!
-
:-DI write code such as following in Visual C++ 6.0: #include "stdafx.h" int main(int argc, char* argv[]) { char c0; double d0; char c1; char c2; printf("%p\n%p\n%p\n%p\n",&c0,&d0,&c1,&c2); return 0; } In Debug build mode, output: 0012FF7C 0012FF6C 0012FF78 0012FF74 Why VC6 put variable d0 on the stack top? Your sincerely REMY
-
:-DI write code such as following in Visual C++ 6.0: #include "stdafx.h" int main(int argc, char* argv[]) { char c0; double d0; char c1; char c2; printf("%p\n%p\n%p\n%p\n",&c0,&d0,&c1,&c2); return 0; } In Debug build mode, output: 0012FF7C 0012FF6C 0012FF78 0012FF74 Why VC6 put variable d0 on the stack top? Your sincerely REMY
-
:-DI write code such as following in Visual C++ 6.0: #include "stdafx.h" int main(int argc, char* argv[]) { char c0; double d0; char c1; char c2; printf("%p\n%p\n%p\n%p\n",&c0,&d0,&c1,&c2); return 0; } In Debug build mode, output: 0012FF7C 0012FF6C 0012FF78 0012FF74 Why VC6 put variable d0 on the stack top? Your sincerely REMY
This is probably because the VC++ compiler is trying to optimize memory allocations, by automatically choosing the ordering and layout of variables in memory in order to minimize memory usage. -- Wessam Fathi