Got problems with #define - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Got problems with #define (
/showthread.php?tid=570873)
Got problems with #define -
Baltazar - 14.04.2015
Код:
#include <a_samp>
main(){
new string[16];
print(string, sizeof(string), "This is my test string");
format(string);
}
As you can see function names are switched. The goal is to
#define print as
format and to
#define format as
print. How do I achieve this? Thanks
Re: Got problems with #define -
Sithis - 14.04.2015
Whatever you want to do, switching these function names is not a good idea.
Re: Got problems with #define -
JaydenJason - 14.04.2015
Edit both functions from inside the a_samp.inc
Re: Got problems with #define -
MP2 - 14.04.2015
Why on earth would you want to do that..?
Re: Got problems with #define -
Baltazar - 14.04.2015
Quote:
Edit both functions from inside the a_samp.inc
|
Bad practice
Quote:
Originally Posted by MP2
Why on earth would you want to do that..?
|
This is just a sample problem. There are other functions that you may want to swap the names of. And I do
The question persists... how to achieve that, huh?
Re: Got problems with #define -
Misiur - 14.04.2015
With macros? Terribly:
pawn Код:
static const stock @ub:emptytag;
#define format @ub:@uq:format
#define print @ub:format
#define @uq:format @ub:print
Might run into tag mismatch
Re: Got problems with #define -
Baltazar - 15.04.2015
Quote:
Originally Posted by Misiur
With macros? Terribly:
pawn Код:
static const stock @ub:emptytag; #define format @ub:@uq:format #define print @ub:format #define @uq:format @ub:print
Might run into tag mismatch
|
I bet preprocessor gets trapped in a never-ending loop. Compilation process freezes