Reputation: 6651
C isn't my first language, but I've written a good bit of it. I am examining a code and I have come across a construct I have never see before:
loop(i,nlevels)
{
/* do stuff based on "i" */
}
There is no do
, for
, or while
. "i" is not acted on inside the loop. I assume this means loop over "i" sequentially from 0 to nlevels (or maybe nlevels-1), but I don't know. I can't find this in K&R. I can't find it on the internet. Can someone enlighten me? Thanks.
Upvotes: 9
Views: 474
Reputation: 37915
This macro is probably defined somewhere:
#define loop(index, steps) for(int index = 0; index <= steps; index++)
Or one that is looking very similar to it
Upvotes: 14
Reputation: 134
Is loop a macro #defined somewhere? It seems an easy enough macro that someone may want to have done so.
Upvotes: 4
Reputation: 53067
loop
is most certainly a macro someone defined as it's not part of the C language.
Search for a #define loop
.
Upvotes: 17