Skip to content

error: identifier "i" is undefined (C99 variable declaration in for loop) #2157

@kgerheiser

Description

@kgerheiser

Trying to build the main branch with icc, and get this error.

.6-zlib-szip/include -fno-strict-aliasing -MT libdispatch_la-nc.lo -MD -MP -MF .deps/libdispatch_la-nc.Tpo -c ../../libdispatch/nc.c -o libdispatch_la-nc.o
../../libdispatch/nchashmap.c(387): error: type name is not allowed
      for (size_t i=1; i < NC_nprimes - 1; i++) {
           ^

../../libdispatch/nchashmap.c(387): error: expected a ";"
      for (size_t i=1; i < NC_nprimes - 1; i++) {
                  ^

../../libdispatch/nchashmap.c(387): error: identifier "i" is undefined
      for (size_t i=1; i < NC_nprimes - 1; i++) {

size_t i should be declared separately if not using C99

for (size_t i=1; i < NC_nprimes - 1; i++) {

I was able to work around the issue by moving the variable declaration to the line above.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions