Here is the scenario;
A header uses an enum as follow:-
This header is included in many source files.Code:typedef enum { NONE, FEW, SOME, MORE, MOST, ALL } qty;
A particular source file has the following enum:-
This source file does not include the header file mentioned earlier, However, due to some new implementation required in the source file, it needed to include the header file. Of course, a compilation error is generated because the label SOME is used in two different enums.Code:typedef enum { MINORITY, SOME, MAJORITY } my_qty;
One easy way is to change the SOME in my_qty enum to a different label and make updates throughout the source file accordingly.
Assuming that I'm not allowed to make the change I previously mentioned, is there any way to include the header and not generate compilation error? Is there any way to still use the locally define SOME in the source file for its internal use, BUT not utilize the SOME in the included header enum?
Note: The new implementation does not require usage of the header enumeration.
Hope my questions are clear enough. Thanks in advance



LinkBack URL
About LinkBacks


