Skip to content

Instantly share code, notes, and snippets.

@yoggy
Last active November 11, 2015 09:53
Show Gist options
  • Select an option

  • Save yoggy/0f40e5cc8e32a03f0c9d to your computer and use it in GitHub Desktop.

Select an option

Save yoggy/0f40e5cc8e32a03f0c9d to your computer and use it in GitHub Desktop.
Cちゃんに発生した状態を検証してみるテスト https://codeiq.jp/magazine/2015/11/33256/
#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;
}
#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;
}
Copy link
Copy Markdown

ghost commented Nov 11, 2015

Focused dashboard,!Fine-grained permissions..?Repositoryne..!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment