Afficher un message
Vieux 07/06/2008, 10h31   #6
Sachin Garg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to restrict 'some' code from getting compiled/built? (without #define)


"Erik Wikström" <Erik-wikstrom@telia.com> wrote in message
news:YWi2k.8131$R_4.6443@newsb.telia.net...
> On 2008-06-06 23:37, Sachin Garg wrote:
>> I need to build two executables from my code, one having all the code
>> (and
>> thus application features) and other not having it all. How to best
>> manage
>> the code that shouldn't go in one of the executables?
>>
>> My first thought is to use conditional compilation with #define and
>> #ifdef
>> etc but its getting messy, are there better ways to manage this?
>>
>> The problem in detail:
>>
>> #. There is a class A with virtual foo1 and foo2
>> #. There are 'lots' of derived classes of A which implement foo1 and foo2
>> #. Executable1 needs to use both foo1 and foo2
>> #. Executable2 only needs to use foo1, never needs foo2
>>
>> How to make sure that all the foo2 code never gets into executable2? Lots
>> of
>> #ifdefs can be used for this but is there a better solution? Maybe some
>> clever use of templates? Something else less complicated?

>
> Instead of preventing the code from being in both executables it might
> be easier to just prevent foo2 from being called, perhaps by using
> #ifdefs to select which kinds of input the program accepts.


I have done this, wanted to also prevent unused code from getting in the
exe.


  Réponse avec citation
 
Page generated in 0,07409 seconds with 9 queries