Linked by Eugenia Loli-Queru on Sat 13th Jan 2007 04:25 UTC
General Development Following on from the tutorial in part 1 of this series, David Chisnall explores some more-flexible mechanisms for allowing processes to communicate on a POSIX-compliant system.
Thread beginning with comment 201453
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: No Clue
by Vargol on Sat 13th Jan 2007 23:47 UTC in reply to "RE: No Clue"
Vargol
Member since:
2006-02-28

pp1ex2.c:11: error: 'for' loop initial declaration used outside C99 mode

I'm afraid you're reading the error message incorrectly, it
actually means that the for(int i=0; ... style of declaring values in loops is part of the C99 standard, but cc's default 'C' is not the ISO 1999 C standard.

Try
cc -std=c99 -Wall -o pp1ex2 pp1ex2.c
and the warning messages will disappear.

Reply Parent Bookmark Score: 1

RE[3]: No Clue
by Doc Pain on Sun 14th Jan 2007 16:20 in reply to "RE[2]: No Clue"
Doc Pain Member since:
2006-10-08

"I'm afraid you're reading the error message incorrectly, it actually means that the for(int i=0; ... style of declaring values in loops is part of the C99 standard, but cc's default 'C' is not the ISO 1999 C standard."

Oops... call me Mister Stupid. :-) The declarations of variables inside for() is of course possible with ISO C 99 (-std=c99), but not with standard C (K&R), where declarations have to be prior to statement lines.

Reply Parent Bookmark Score: 2