Macros help
#1

Hello guys,
Is there any way to get the optional parameters from a macro like in C++, with __VA_ARGS__?

To have this:
Код:

#define Func1(...) \
    Func2(<Some constant like in C++ __VA_ARGS__ here>, 0)
Example:
Код:
ShowPlayerDialog(playerid, DIALOG, DIALOG_STYLE_LIST, Func1("HEADER"), Func1("WELCOME_MSG", GetName(playerid)), Func1("Go"), Func1("Quit"));
The intention here is that when the macro is called the 'Func2' will always have at least 2 arguments. Is there any way to do this in pawn?

Thanks,
Michael
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Thank you. This helps but I am getting run time error. Since I am trying this with a function from your library. How can I add a default for va_args and va_format when none are specified.
Reply
#3

Sorry, let me clarify. When nothing is specified for 'va_args<>', the server gets run time error 5 which is invalid memory access. How can I prevent this from happening. This is the reason to try with macros but it does not work as expected.
Reply
#4

YSI v4
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)