Qt-interest Archive, July 2007
how to switch off "warning C4288: nonstandard extension used" ?
Message 1 in thread
Hi All.
When I compile this:
void main()
{
for(int row = 0; ;){}
int row = 10;
row ++;
}
I get warning:
warning C4288: nonstandard extension used : 'row' : loop control
variable declared in the for-loop is used outside the for-loop scope; it
conflicts with the declaration in the outer scope
Boring :( Does anyone know how to switch it off?
BTW, my compiler is vs2003 for Qt4.3.0.
Thanks,
Lingfa
--
[ signature omitted ]
Message 2 in thread
I would check a VC list on this... It has nothing to do with QT
Scott
> -----Original Message-----
> From: Lingfa Yang [mailto:lingfa@xxxxxxx]
> Sent: Friday, July 13, 2007 8:23 AM
> To: Qt Interest
> Subject: how to switch off "warning C4288: nonstandard extension used"
?
>
> Hi All.
>
> When I compile this:
> void main()
> {
> for(int row = 0; ;){}
> int row = 10;
> row ++;
> }
>
> I get warning:
> warning C4288: nonstandard extension used : 'row' : loop control
> variable declared in the for-loop is used outside the for-loop scope;
it
> conflicts with the declaration in the outer scope
>
> Boring :( Does anyone know how to switch it off?
> BTW, my compiler is vs2003 for Qt4.3.0.
>
> Thanks,
> Lingfa
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 3 in thread
"Lingfa Yang" <lingfa@xxxxxxx> wrote in message
news:469798D3.9060309@xxxxxxxxxx
> Hi All.
>
> When I compile this:
> void main()
> {
> for(int row = 0; ;){}
> int row = 10;
> row ++;
> }
>
> I get warning:
> warning C4288: nonstandard extension used : 'row' : loop control variable
> declared in the for-loop is used outside the for-loop scope; it conflicts
> with the declaration in the outer scope
>
> Boring :( Does anyone know how to switch it off?
> BTW, my compiler is vs2003 for Qt4.3.0.
From project setting, go to Configuration Properties|C/C++|Language
and change "Force Conformance In For Loop Scope" to YES.
BTW on more conformant compilers you'll probably get a warning
about writing void main() instead of int main()...
--
[ signature omitted ]
Message 4 in thread
Lingfa Yang wrote:
> Hi All.
>
> When I compile this:
> void main()
> {
> for(int row = 0; ;){}
> int row = 10;
> row ++;
> }
>
> I get warning:
> warning C4288: nonstandard extension used : 'row' : loop control
> variable declared in the for-loop is used outside the for-loop scope;
> it conflicts with the declaration in the outer scope
>
> Boring :( Does anyone know how to switch it off?
> BTW, my compiler is vs2003 for Qt4.3.0.
You could use:
#pragma warning( disable : 4288)
but it would be better to use different names...
- Keith
--
[ signature omitted ]
Message 5 in thread
"Keith Sabine" <keith@xxxxxxxxxxxxxx> wrote in message
news:46979D55.2080106@xxxxxxxxxxxxxxxxx
> Lingfa Yang wrote:
>> Hi All.
>>
>> When I compile this:
>> void main()
>> {
>> for(int row = 0; ;){}
>> int row = 10;
>> row ++;
>> }
>>
>> I get warning:
>> warning C4288: nonstandard extension used : 'row' : loop control variable
>> declared in the for-loop is used outside the for-loop scope; it conflicts
>> with the declaration in the outer scope
>>
>> Boring :( Does anyone know how to switch it off?
>> BTW, my compiler is vs2003 for Qt4.3.0.
>
>
> You could use:
>
> #pragma warning( disable : 4288)
>
> but it would be better to use different names...
Better to make the compiler correct.
A better example that won't work is:
for(int i = 0; ;){}
for(int i= 0;;){}
MSVC6 and before treat the scope of for loops
incorrectly. MSVC7.1 has an option to force conformance
to be correct but defaults it to off. MSVC8 has the same
option but I think it defaults it to conforming.
--
[ signature omitted ]
Message 6 in thread
> You could use:
>
> #pragma warning( disable : 4288)
>
> but it would be better to use different names...
>
> - Keith
>
Keith, Yes, it works for me.
Duane, I don’t know why it doesn't work when I switch to “YES”.
It seems I'd better void using the same name.
Thanks everyone for your help.
Lingfa
--
[ signature omitted ]
Message 7 in thread
"Lingfa Yang" <lingfa@xxxxxxx> wrote in message
news:4697C718.10606@xxxxxxxxxx
>
>> You could use:
>>
>> #pragma warning( disable : 4288)
>>
>> but it would be better to use different names...
>>
>> - Keith
>>
> Keith, Yes, it works for me.
> Duane, I don?t know why it doesn't work when I switch to ?YES?.
You need to rebuild your project.
> It seems I'd better void using the same name.
Probably a good idea but you should fix
the scope problem as well IMO.
Anyway, have fun...
--
[ signature omitted ]