Skip to content

Instantly share code, notes, and snippets.

@RicoP
Created April 20, 2012 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RicoP/2429741 to your computer and use it in GitHub Desktop.
Save RicoP/2429741 to your computer and use it in GitHub Desktop.
Quickloop
#include <stdio.h>
#define repeat(VAR,TO,ACTION) \
{ \
int VAR = 0; \
switch((TO) % 8) { \
while(VAR != (TO)) { \
ACTION; VAR++; \
case 7: \
ACTION; VAR++; \
case 6: \
ACTION; VAR++; \
case 5: \
ACTION; VAR++; \
case 4: \
ACTION; VAR++; \
case 3: \
ACTION; VAR++; \
case 2: \
ACTION; VAR++; \
case 1: \
ACTION; VAR++; \
case 0: ; \
} \
} \
}
int main(int argc, char** argv) {
repeat(i, argc, {
printf("%s", argv[i]);
printf("\n");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment