View Single Post
Author Message
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-03-2014 , 13:27   [INFO] Pawn compiler constants
Reply With Quote #1

I was really bored, so about half an hour ago, I was goofing around and wanted to implement __DATE__ constant in Sublime Text. When I compiled that code (without really implementing it), it compiled just fine. I quickly put '-l' (listing) compiler switch, which shows pre-processor stuff, so I was able to see what happened, and I really found today's date in the code.

I took a quick look at Pawn compiler code (sc1.c file precisely). I found some neat stuff I didn't know about, there are few more constants!
So, I ran this code on my local server:
PHP Code:
server_print("Constants:");
server_print("__DATE__: %s"__DATE__); // Current date
server_print("__TIME__: %s"__TIME__); // Current time
server_print("cellbits: %d"cellbits); // Cell size in bits
server_print("cellmax: %d"cellmax); // Maximum value that cell can hold
server_print("cellmin: %d"cellmin// Minimum value that cell can hold
server_print("__Pawn: %d"__Pawn); // Pawn version as an integer
server_print("debug: %d"debug); // Debug level, I guess (-d compiler switch alters this) 
And this is the output in server console:


I just thought it may be useful to someone, so I decided to share this. I personaly find __DATE__ and __TIME__ really useful.
There are actually few more, but I don't think they are worth mentioning.

Last edited by klippy; 12-03-2014 at 13:29.
klippy is offline