Re: c++ code - not getting compiled !!!!!!!!!
Steve Graegert (スティーブ) <[email protected]> Fri, 29 Jul 2011 08:40:22 +0200
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <CALC0UTm2XrznifP=m63sibg931vmzrQP+8FVzvxYgqvTNrG7sA@mail.gmail.com> |
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
>