It is currently Thu Jun 20, 2013 5:40 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Compiler macros
PostPosted: Thu Mar 08, 2012 2:59 pm 
Offline
Addict
Addict

Joined: Sat Dec 31, 2005 5:24 pm
Posts: 2970
Location: Where ya would never look.....
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?

_________________
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.


Top
 Profile  
 
 Post subject: Re: Compiler macros
PostPosted: Thu Mar 08, 2012 4:25 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jan 21, 2011 8:25 am
Posts: 560
There are pre-defined constants, e.g. #PB_COMPILER_DATE that do the same job.

_________________
Image
ImageImageImage
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds


Top
 Profile  
 
 Post subject: Re: Compiler macros
PostPosted: Thu Mar 08, 2012 7:59 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5184
Location: Germany
See here (at the bottom): http://www.purebasic.com/documentation/ ... tives.html

_________________
Perl – The only language that looks the same before and after RSA encryption.
-- Keith Bostic


Top
 Profile  
 
 Post subject: Re: Compiler macros
PostPosted: Thu Mar 08, 2012 8:42 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1579
Location: Germany
Offtopic:
@freak
Adding html anchors to the online and offline help would be useful. This way e.g. http://www.purebasic.com/documentation/ ... -constants or selecting the title from the navigation menu would directly jump to the bottom. It can be easily implemented using the id attribute (info here: http://www.w3.org/TR/html4/struct/links.html#h-12.2.3).


Top
 Profile  
 
 Post subject: Re: Compiler macros
PostPosted: Fri Mar 09, 2012 1:29 pm 
Offline
Addict
Addict

Joined: Sat Dec 31, 2005 5:24 pm
Posts: 2970
Location: Where ya would never look.....
Thanks for the replys folks, not exactly what I was talking about but close enough I guess. :)

_________________
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.


Top
 Profile  
 
 Post subject: Re: Compiler macros
PostPosted: Fri Mar 09, 2012 2:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 09, 2011 7:57 am
Posts: 276
pb devs should add the macro __COUNTER__ which could be usefull.

Code:
#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;
}


result
Quote:
0
1
2
3
4
5

0
1
2

0
1
2
3
4
5


_________________
http://www.mediafire.com/pbstuff


Top
 Profile  
 
 Post subject: Re: Compiler macros
PostPosted: Fri Mar 09, 2012 5:45 pm 
Offline
Addict
Addict

Joined: Thu Nov 01, 2007 5:37 pm
Posts: 1579
Location: Germany
@xorc1zt
Well, there is the #PB_Compiler_EnumerationValue constant. Not exactly what you wanted but maybe you didn't know it so far:
Code:
  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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye