0

In my project I have a definition.h file in which I make most of my #define's.

Most of the defines depend on another value. for example:

#if STATE_IS(ITALY)

#define     LANGUAGE        "Italian"                   
#define     FOOD            "Pizza"
.
.
#elsif STATE_IS(JAPAN)

#define     LANGUAGE        "Japanese"                  
#define     FOOD            "Sushi"
.
.

this file become really big and confusing. How can I manage this definitions in an elegant way?

talw
  • 61
  • 2
  • 1
    It's not quite clear to me what you want to achieve. Your program should incorporate the setting for only one country, right? What are `ITALIAN` and `PIZZA`? (I guess the example you've shown is made up, but it's not clear what you want to achieve. Maybe the preprocessor isn't the right wy to do what you want.) – M Oehm Nov 19 '15 at 12:55
  • yes program should incorporate the setting for only one country. – talw Nov 19 '15 at 12:58
  • And what are, for example, `ITALIAN` and `PIZZA`? Just data? – M Oehm Nov 19 '15 at 13:01
  • Im sorry they are strings. I'll edit my question – talw Nov 19 '15 at 13:04
  • Does all countries have exactly same macros (with only different data)? Are all defines strings? What are these defines used for? – user694733 Nov 19 '15 at 13:16
  • Wouldn't you have a translated data file - that would be loaded at run-time - this contains the defines/strings. If you have data that is country dependent then this would require more code changes to allow for the fact it's loaded at run-time. This would eliminate the need for doing a country dependent build just for your defines. – Neil Nov 19 '15 at 13:26

0 Answers0