Problem with macro
#1

Good morning. I'm making a macro in order to traverse the vector of a variable, but as I do not know much about macros, is giving an error:
Код:
error 075: input line too long (after substitutions)
Macro:
pawn Код:
#define percorrerVetor(%1[%2])\
        for(new %3; %3 < %2; %3++)\
        {\
            loopstart:\
        }\
        goto loopstart;\
And how I write this macro (or function) more readable and better performance?

Thanks!
Reply
#2

You have that error because you put a \ at the end, so the compiler think you want to include the next -empty- line as part of the macro.

There are other problems:

You don't have a third parameter in the pattern, but later you use %3.
You need to add a space between the pattern and the replacement.
You should put the replacement inside brackets.
You should put a ; at the end of the pattern.

pawn Код:
#define percorrerVetor(%1[%2],%3); \
{\
  for(new %3; %3 < %2; %3++)\
  {\
    loopstart:\
  }\
  goto loopstart;\
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)