>What is the simplest explanation as to why these are needed? Why not just set regular variable values? So what if they are constant and don't change?
Here's one thing they're useful for:
Suppose you have an application you're selling, to multiple registered companies/users and in multiple languages. #DEFINEs let you do this
without changing your source code.
#INCLUDE Language.h
#INCLUDE CompanyInfo.h
...
[Language_ENU.h]
#DEFINE SomeCharString "English Message"
[Language_ESP.h]
#DEFINE SomeCharString "Spanish Message"
[Company1Info.h]
#DEFINE CompanyName "Some Company"
[Company2Info.h]
#DEFINE CompanyName "A Different Company"
- Overwrite Language.h with Language_ESP.h
- Overwrite CompanyInfo.h with Company2Info.h
- Recompile All, et voila !
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up