I've got a very big program which compiles with gcc without warnings.
If I turn on c99 mode --std=c99 on the command line, it gives a huge number of warnings and errors.
But I love the idiom for(int i=0; i<20; i++){ code }
in place of {int i; for (i=0; i<20; i++){ code }}
Is there any way to tell gcc to allow this and only this?
Alternatively, is there any way to enable c99 mode in the particular functions I'm working on? Something like
#pragma c99 on
for(int i=0; i<99; i++)
{
code
}
#pragma c99 off
It is likely that the warnings and errors are because -std=c99
requests standard-conforming C99, which means that many platform-specific functions that pollute the C99 namespace are not defined.
Instead, you should try --std=gnu99
, which is the C99-equivalent to the default mode of gnu89
.