c++ - what does this loop means: for(j,0,np) -


inline string search_prod(string p) //returns concatenated string of variables can produce string p     {         int j,k;         string r="";         for(j,0,np)         {             k=1;             while(gram[j][k] != "")             {                 if(gram[j][k] == p)                 {                     r=concat(r,gram[j][0]);                 }                 k++;             }         }            return r;     } 

i have never seen loop before.

okay. @ashishjohn question solvable.

in provided link can see define in beginning changes syntax of loops:

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

so for(j,0,np) converted preprocessor to:

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

which normal loop. np declared in file , nothing global integer variable.


however, @molbdnilo pointed out correctly standard (n4296) forbids declaration of macros override existing keywords:

17.6.4.3.1 macro names

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

  2. a translation unit shall not #define or #undef names lexically identical keywords, identifiers listed in table 2, or attribute-tokens described in 7.6

therefore may or may not behave described it.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -