CSpider icon indicating copy to clipboard operation
CSpider copied to clipboard

Is there a problem with C99/C11?

Open AntonioCS opened this issue 9 years ago • 6 comments

What is the issue with the int in the for loop declaration? Gcc and Clang both support C99 and C11.

AntonioCS avatar Dec 27 '15 14:12 AntonioCS

variable declared within for-loop is visible in the first following line since C11(C++ 11). e.g. for(int i=0; ;) { } i++;

BUT we are writing C.

mzer0-yu avatar Dec 27 '15 14:12 mzer0-yu

C11 is C. The ability do declare and use variables in the for loop declaration simplifies code.

AntonioCS avatar Dec 27 '15 14:12 AntonioCS

With gcc, -std=c99 must be declared. Which was not specified in Makefile.

ghost avatar Dec 27 '15 14:12 ghost

OK. Changes will be added to dev branch.

mzer0-yu avatar Dec 27 '15 15:12 mzer0-yu

Great.

ghost avatar Dec 27 '15 15:12 ghost

:+1:

AntonioCS avatar Dec 27 '15 17:12 AntonioCS