It happened again.
I have many cases of modules with something like #ifdef TYPEA ... many lines #endif #ifdef TYPEB ... many similar lines #endif #ifdef TYPEC ... many similar lines #endif
It happens that I am looking at the type b code trying to figure out something in type a (the codes are VERY similar).
To avoid this, I have tried
blah,blah // comment TYPEA
and that "kind of works"
Now, the ideal would be if for type a I could do the following: #ifdef TYPEA #define ATYPE #define BTYPE // #define CTYPE // #endif
and then just make it ATYPE blah,blah // comment
Of course this does not work. Does anyone have a trick that makes this possible?
Erik
In this particular case, I really can't see why you want to keep all these variants in one file --- 200 lines is well worth starting a new file. This would be a lot easier by putting these segments into separate files, and then in the main file just writing
#if defined(VARIANT_A) # include "fragment_foo_A.c"
Anyhow, Hans-Bernhard, I do appreaciate your efforts, believe me. However I was looking for a simple solution to something that happens about once or twice a year.
As to the #include, I do that by a switch in the ,bat file like this fragemet show
IF "%1"=="b" goto lcb IF "%1"=="ba" goto lcba ......
:lcb copy ..\ss\usmainb.c usmain.c >..\trash\trashbin copy ..\ss\usledst1.c usledstb.c >..\trash\trashbin copy ..\ss\ussgndv1.c ussgndvr.c >..\trash\trashbin goto lxx
Again, I apprecieate your efforts and am sure that your solutions work, but none accomplish the original desire of a simple solution, not to a problem, but to an annoyance.
Lets us stop here