c++ - Why is jumping across variable definitions (with goto) allowed? -



c++ - Why is jumping across variable definitions (with goto) allowed? -

this question has reply here:

why ok jump scope of object of scalar type w/o initializer? 2 answers

i confused variable definition, when playing goto , switch statements. below code accepted compiler:

goto label0; int j; // skipped "goto" label0: j = 3;

my questions are:

since definition of int j; skipped, how programme create object j , later assign value in j = 3 ? is code between goto , label compiled? is code between goto , label executed? (at run-time) does variable definition happen @ compile-time(or more proper term) or run-time?

(i inquire new question focusing more on relative order of variable definition , compilation , execution. )

just found question close answer:

why ok jump scope of object of scalar type w/o initializer?

to summarize , reply questions:

the goto run-time thing. definition still happens; yes compiled. no not executed. definition happens despite part skipped goto.

c++ variables

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -