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 <ratheesh.ksz@xxxxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Assembler]
[Git]
[Kernel List]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[Yosemite Campsites]
[Yosemite News]
[GCC Help]