Re: c++ code - not getting compiled !!!!!!!!!
ratheesh kannoth <[email protected]> Fri, 29 Jul 2011 12:25:39 +0530
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <CAGZFCEF=Xuf6kBMe=iGVvW4uf8Bd63gKjCQa-VkKbPihhj0cRg@mail.gmail.com> |
Thanks steve. This code snippet works fine in newer version of g++. Am i right ?. i am not sure abt the version of g++. -Ratheesh 2011/7/29 Steve Graegert (スティーブ) <[email protected]>: > According to the C++ standard (6.7) you are allowed to jump past a declaration: > > "It is possible to transfer into a block, but not in a way that > bypasses declarations with initialization. A program that jumps from a > point where a local variable with automatic storage duration is not in > scope to a point where it is in scope is ill-formed unless the > variable has POD type and is declared without an initializer." > > \Steve > > -- > > Steve Graegert (スティーブ) > Mobile: +49 151 25335249 > http://graegert.tel > > > > On Fri, Jul 29, 2011 at 08:01, ratheesh kannoth <[email protected]> wrote: >> #include <iostream> >> >> using namespace std; >> >> int main() >> { >> int i; >> >> cout << "Enter value of i " << endl; >> cin >> i; >> >> if (i < 5) >> goto Sri; >> >> int j = 6; >> cout << "j = " << j << endl; >> >> cout << "Outside Sri" << endl; >> return 0; >> >> Sri: >> cout << "Inside Sri" << endl; >> return 0; >> } >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in >> the body of a message to [email protected] >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > -- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html