Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

C++ separate code based on the few changes

Programming


Tags
c++ separate code

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-09-2017
SA_Palani SA_Palani is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 21 February 2017, 11:01 AM EST
Posts: 24
Thanks: 2
Thanked 0 Times in 0 Posts
Lightbulb C++ separate code based on the few changes

Hi,

I am working in Visual studio 2008 in which i have written the code in c++,qml,qt.Its a simulator application.

I would like to create a simulator with certain changes. In order to do that i have modified the code with few changes based on the preprocessor condition.


Code:
#define SECOND_SIMULATOR

#ifdef SECOND_SIMULATOR
         code related small changes
else
         code related to main UI
#endif


Is there any way to separate the code other than preprocessor ?

Moderator's Comments:
C++ separate code based on the few changes
Please wrap all code, files, input & output/errors in CODE tags.
It makes it far easier to read and preserves multiple spaces for indenting or fixed width data.

Last edited by rbatte1; 01-09-2017 at 08:32 AM.. Reason: Added CODE tags
Sponsored Links
    #2  
Old Unix and Linux 01-09-2017
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 23 September 2017, 6:14 PM EDT
Location: San Jose, CA, USA
Posts: 10,508
Thanks: 542
Thanked 3,675 Times in 3,135 Posts
There are millions of ways to separate the code other than using the preprocessor.

What do you want to use other than whether or not SECOND_SIMULATOR has been #defined to make the decision of what code to use?
Sponsored Links
    #3  
Old Unix and Linux 01-09-2017
SA_Palani SA_Palani is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 21 February 2017, 11:01 AM EST
Posts: 24
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Don Cragun View Post
There are millions of ways to separate the code other than using the preprocessor.

What do you want to use other than whether or not SECOND_SIMULATOR has been #defined to make the decision of what code to use?
Thanks for your quick reply. Could you tell me any of 2 ways.
I would like to know the efficiency of using this and other ways.so I can use the better one.
Thank you
    #4  
Old Unix and Linux 01-09-2017
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 23 September 2017, 6:14 PM EDT
Location: San Jose, CA, USA
Posts: 10,508
Thanks: 542
Thanked 3,675 Times in 3,135 Posts
There is no possible way to answer that question until you explain what you are trying to do!
Sponsored Links
    #5  
Old Unix and Linux 01-09-2017
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 22 September 2017, 5:42 PM EDT
Location: Saskatchewan
Posts: 22,417
Thanks: 1,126
Thanked 4,235 Times in 3,915 Posts
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Separate output based on dates Jimmy_the_tulip Shell Programming and Scripting 5 09-25-2014 08:32 PM
How to separate based on delimiter? arghadeep adity Shell Programming and Scripting 8 03-18-2014 02:59 PM
How to separate a statement based on some delimiter and store each field in a variable? arghadeep adity Shell Programming and Scripting 3 03-17-2014 12:17 PM
Separate string based on delimiter mohtashims Shell Programming and Scripting 4 02-23-2014 05:24 PM
Separate based on file names prashk15 Shell Programming and Scripting 2 02-04-2008 08:37 AM



All times are GMT -4. The time now is 01:03 AM.