Forum

For Loops in C in Visual Studio 2008

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

For Loops in C in Visual Studio 2008

Postby Baker » Tue May 08, 2012 9:22 pm

I prefer to be able to declare a loop variable in a for loop. Can this somehow be "enabled" in C for Visual Studio 2008?

Code: Select all
for (int i = 0; i < 10; i ++)


Instead of having to declare i BEFORE the for loop.

Code: Select all
int i;
for (i = 0; i < 10; i ++)


Plus I don't like having loop variables needlessly available outside the actual loop.

Any way to make Visual Studio do this for C in say Microsoft Visual Studio C++ Express 2008?

(CodeBlocks + GCC lets me do with a C99 compiler flag; Clang/LLVM likewise allows this behavior in for loops.)
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: For Loops in C in Visual Studio 2008

Postby mh » Tue May 08, 2012 10:50 pm

MSVC doesn't support this C99 feature. :(
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest