rcthomas / resist

BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Intel C compiler fails on resist-context.c without "-std=c99" flag #12

Closed bcfriesen closed 7 years ago

bcfriesen commented 7 years ago

The Intel compiler does not enable C99 features by default, and as a result, it fails to compile resist-context.c:

cc -O0 -Wall -Werror -c resist-context.c -o resist-context.o
resist-context.c(74): error: type name is not allowed
      for (size_t i = 1; i < ctx->wl_count; i++) {
           ^

resist-context.c(74): error: expected a ";"
      for (size_t i = 1; i < ctx->wl_count; i++) {
                  ^

resist-context.c(74): error: identifier "i" is undefined
      for (size_t i = 1; i < ctx->wl_count; i++) {

We could either require C99 support to compile resist, or remove C99-specific features. I would vote for the latter because it is easy to do and requires fewer compiler flags (i.e., none).

rcthomas commented 7 years ago

Hmmm, but tgmath.h...

bcfriesen commented 7 years ago

Does tgmath.h require C99? If so then we can go with the extra-flag route. There's nothing wrong with requiring C99 IMO, it's pretty commonly supported AFAIK.

rcthomas commented 7 years ago

It was formally introduced with C99, but I don't know the prior history that well. I do not think it would be too onerous of us to require C99 (not even talking about C11) for compilation, except that it may confuse you if you work on too many codes in C! I'm in favor of C99...