luohaha/CSpider

Is there a problem with C99/C11?

AntonioCS opened this issue · 6 comments

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

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.

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

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

OK. Changes will be added to dev branch.

Great.

👍