Compiler macros
Posted: Thu Mar 08, 2012 2:59 pm
MS compilers have pre-defined macros like the (_WIN64) macro. Never thought about it before, but I was wondering what predefined, if any, macros the PB compiler has?
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
#include <stdio.h>
int curCounter = 0;
#define RESET_COUNTER curCounter = __COUNTER__ + 1
#define GET_COUNTER __COUNTER__ - curCounter
int main()
{
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
RESET_COUNTER;
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
RESET_COUNTER;
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
printf (" %d\n", GET_COUNTER );
return 0;
}
0
1
2
3
4
5
0
1
2
0
1
2
3
4
5
Code: Select all
Enumeration
#GadgetInfo ; Will be 0
#GadgetText ; Will be 1
#GadgetOK ; Will be 2
EndEnumeration
Enumeration #PB_Compiler_EnumerationValue
#GadgetCancel ; Will be 3
#GadgetImage ; Will be 4
#GadgetSound ; Will be 5
EndEnumeration