Mailing List Archive

C99 smoke results
tl;dir
It appears that the smokers we use support almost all the C99 features
we desire to use

I took a big subset of the C99 features mentioned that people would
like, and submitted a smoke test to just change the defaults from C89 to
C99. The results can be found in detail here:

http://perl.develop-help.com/?b=smoke-me%2Fkhw-c99

and this email summarizes them.

There were several people who didn't think we should be using //
comments, so I didn't try testing that.

The use of variable length arrays was suggested, where the length could
be specified from a variable. I did try that, and some worked, some
did not. It was pointed out on #irc that that feature was made optional
for compilers to support in C11. Hence we shouldn't be using it anyway

More case: statements in a switch than C89 requires to be supported
No problem

The remainder had issues in Windows MSVC100 and earlier compilers.
Tomasz Konojacki came up with a workaround that works for all the tested
features but one. And that workaround is to force C++ mode on these.

The one feature it doesn't work on is the nice struct initializers

.foo = bar

And that is because this feature was only this year added to the C++
standard. We only support C++ for header compilations, so this means it
isn't a show stopper; we just couldn't use those in hdr files. But
"just" here is a big deal. And in practice we do plenty of C++
compilations, and would have to fix up our Make infrastructure to work
around this. It turns out, however, that there is a github module that
claims to preprocess these initializers into C89 form. I would rather
spend any effort we do end up doing on making that work for us. The
payoff would be better. If someone has that itch, feel free.

The other test failures were from smokers that explicitly called for
erroring C99 constructs.

The other things I tested were:

intermixed declarations and code. No problem outside old MSVC

declaring the loop variable in the loop: for (int i=0; i < foo; i++) .
No problem outside old MSVC

being able to say struct { ... foo[] ) instead of having to put a number
in the array declaration. No problem outside old MSVC