Created
October 9, 2011 12:01
-
-
Save 7shi/1273594 to your computer and use it in GitHub Desktop.
スタック消費テスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <array> | |
#include <vector> | |
void test1() { | |
int a; | |
printf("test1.&a: %p\n", &a); | |
} | |
void test2() { | |
int _[4096]; | |
_[0] = 0; | |
test1(); | |
} | |
void test3() { | |
std::array<int, 4096> _; | |
_[0] = 0; | |
test1(); | |
} | |
void test4() { | |
std::vector<int> _(4096); | |
_[0] = 0; | |
test1(); | |
} | |
int main() { | |
int a; | |
printf("main.&a: %p\n", &a); | |
test1(); | |
test2(); | |
test3(); | |
test4(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Release build | |
main.&a: 0013FF78 | |
test1.&a: 0013FF6C | |
test1.&a: 0013BF5C | |
test1.&a: 0013BF5C | |
test1.&a: 0013FF08 | |
* Debug build | |
main.&a: 0013FF60 | |
test1.&a: 0013FE80 | |
test1.&a: 0013BDA0 | |
test1.&a: 0013BDA0 | |
test1.&a: 0013FD80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment