Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C++ Define help needed

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
jeremy6996
Expert Cheater
Reputation: 0

Joined: 20 May 2007
Posts: 100

PostPosted: Sun Jul 08, 2007 6:32 pm    Post subject: C++ Define help needed Reply with quote

I get the whole code and I know what it does but I don't get this.

Code:
#define aa
#ifdef aa
//Do somthing
#else
//Do somthing
#endif


The thing I don't get is. Why would it not be defined it it got through the debugger. And I put the define code up there. What is the "#ifdef" used for? I know its to see if it was defined or not, but why would it not be defined?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sun Jul 08, 2007 6:35 pm    Post subject: Reply with quote

it wouldnt be defined if you

a) took out the line
b) #undef it
Back to top
View user's profile Send private message
jeremy6996
Expert Cheater
Reputation: 0

Joined: 20 May 2007
Posts: 100

PostPosted: Sun Jul 08, 2007 6:37 pm    Post subject: Reply with quote

appalsap wrote:
it wouldnt be defined if you

a) took out the line
b) #undef it


=P I see. But that brings up another one of my questions, why do people bother to #undef things?
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sun Jul 08, 2007 6:40 pm    Post subject: Reply with quote

jeremy6996 wrote:
why do people do this?


ok, say you were developing a shareware program, and have two editions, trial and full.

Code:

#ifdef FULL
   do_awesome_stuff();
#else
   obnoxious_message("sorry this feature is only enabled in the full version");
#endif


now you only have to #define FULL if you want to build the application for your registered users instead of maintaining two seperate programs.
Back to top
View user's profile Send private message
jeremy6996
Expert Cheater
Reputation: 0

Joined: 20 May 2007
Posts: 100

PostPosted: Sun Jul 08, 2007 6:42 pm    Post subject: Reply with quote

Oh, I get it now thanks.
Back to top
View user's profile Send private message
benlue
Moderator
Reputation: 0

Joined: 09 Oct 2006
Posts: 2142

PostPosted: Sun Jul 08, 2007 8:17 pm    Post subject: Reply with quote

Question answered, locked.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites