Using Colon instead of Paren. to define params in #define
#1

I was just curious if anyone had found a way to use characters besides () to enclose the (well, i don't even want to enclose is) parameters
example:
pawn Код:
#define Coord:%1 Float:%1x, Float:%1y, Float:%1z
new Coord:pPos;
as i was writing this i realized it wouldn't be as effective as i thought. Because in order to pass the coords you would have to do
pawn Код:
Functionthatneeds3floatspassed(Coord:pPos);
but meh, I still want to know.


Edit:FAIL, that would be putting Float: infront of the vars, it may give errors, or it may just cast them to the tag they already are.
Reply
#2

i just read that thread, and read the guide last sunday completely through, searched it again today to see if there was anything on this.

but i am guessing the answer is no.

edit: FAIL, again on my part, just went to your thread and saw that you use this (sort of), now i am wondering why it gave me like 500 errors (8)

edit2: thinking i am on to something by doing this, experimenting now

pawn Код:
#define Coord:%1(%2) Float:%1x, Float:%1y, Float:%1z
edit3: this requires me to do
pawn Код:
new Coord:lol();
me no-likey

edit4: Half win. i got it too work by doing this
pawn Код:
#define Coord:%1; Float:%1x, Float:%1y, Float:%1z;
(the semicolons)
but now it won't really work for passing it to a function, (i got around the re-casting the tag)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)