Why aren't unsigned OpenMP index variables allowed?

Posted by Moe on Stack Overflow See other posts from Stack Overflow or by Moe
Published on 2010-05-12T16:08:11Z Indexed on 2010/05/12 19:24 UTC
Read the original article Hit count: 203

Filed under:

I have a loop in my C++/OpenMP code that looks like this:

#pragma omp parallel for
for(unsigned int i=0; i<count; i++)
    // do stuff

When I compile it (with Visual Studio 2005) I get the following error:

error C3016: 'i' : index variable in OpenMP 'for' statement must have signed integral type

I understand that the error occurs because i is unsigned instead of signed, and changing i to be signed removed this error. What I want to know is why is this an error? Why aren't unsigned index variables allowed? Looking at the MSDN page for this error gives me no clues.

© Stack Overflow or respective owner

Related posts about openmp

Related posts about c++