[Solved] what does this loop means: for(j,0,np) [closed]


Okay. Thanks to @AshishJohn this question is now solvable.

In the provided link you can see a define in the beginning which changes the syntax of for loops:

#define for(i,a,b) for(i=a;i<b; i++)

So for(j,0,np) will be converted by the preprocessor to:

for (j=0; j<np; j++)

which is a normal for loop. np is also declared in the file and is nothing but a global integer variable.


However, as @molbdnilo pointed out correctly the standard (N4296) forbids the declaration of macros that override existing keywords:

17.6.4.3.1 Macro names

  1. A translation unit that includes a standard library header shall not #define or #undef names declared in any standard library header.

  2. A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 2, or to the attribute-tokens described in 7.6

Therefore it may or may not behave like I described it.

3

solved what does this loop means: for(j,0,np) [closed]