For Loops in C in Visual Studio 2008

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

For Loops in C in Visual Studio 2008

Post by Baker »

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 ..
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: For Loops in C in Visual Studio 2008

Post by mh »

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
Post Reply