Re: c++ code - not getting compiled !!!!!!!!!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 (スティーブ) <graegerts@xxxxxxxxx>:
> 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


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux