Last active
November 11, 2015 09:53
-
-
Save yoggy/0f40e5cc8e32a03f0c9d to your computer and use it in GitHub Desktop.
Cちゃんに発生した状態を検証してみるテスト https://codeiq.jp/magazine/2015/11/33256/
This file contains hidden or 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> | |
| void goal() | |
| { | |
| puts("goal!"); | |
| } | |
| int main(int argc, char *argv[]) | |
| { | |
| void (*f)(); | |
| goto hoge; // ここでhogeに飛ぶと… | |
| f = goal; | |
| hoge: | |
| f(); // fの中身が未定義で落ちる | |
| return 0; | |
| } | |
This file contains hidden or 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> | |
| int main(int argc, char *argv[]) | |
| { | |
| char *str[] = {"fuga0", "fuga1", "fuga2"}; | |
| int i; | |
| goto hoge; // ここでhogeに飛ぶと… | |
| for (i = 0; i < 3; ++i) { | |
| hoge: | |
| printf("%s\n", str[i]); // iが初期化されないので、ここで落ちる | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Focused dashboard,!Fine-grained permissions..?Repositoryne..!