C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

conditional compilation

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Gary Wessle
Guest





PostPosted: Thu Oct 26, 2006 9:10 am    Post subject: conditional compilation Reply with quote



Hi

I need to create an object of her_t OR his_t inside a namespace. the
choice should be decided based on a macro. did the following
accomplish this?

thank you.

// macro
// uncomment ONLY ONE of the 2 lines below
#define HIS
//#define HER


namespace s_inf
{
....

#ifdef HIS
his_t conn; // FXGame OR FXTrade
#endif

#ifdef HER
her_t conn;
#endif

....
}

the above created his_t and NOT her_t object. right?

// place in a ".h" file and #include it in ".cpp" file and use the
object "conn".
Back to top
Leo
Guest





PostPosted: Thu Oct 26, 2006 9:10 am    Post subject: Re: conditional compilation Reply with quote



Yeah, It will.
When you start compiling, your code is done.
Gary Wessle wrote:
Quote:
Hi

I need to create an object of her_t OR his_t inside a namespace. the
choice should be decided based on a macro. did the following
accomplish this?

thank you.

// macro
// uncomment ONLY ONE of the 2 lines below
#define HIS
//#define HER


namespace s_inf
{
...

#ifdef HIS
his_t conn; // FXGame OR FXTrade
#endif

#ifdef HER
her_t conn;
#endif

...
}

the above created his_t and NOT her_t object. right?

// place in a ".h" file and #include it in ".cpp" file and use the
object "conn".
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.