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
a translation unit includes standard library header shall not #define or #undef names declared in standard library header.
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
Post a Comment