Quote:
Originally posted by JMS
Paul, there is no C or C++ include file which doesn't also include a wrapper macro which I know of. Likewise there are many macros in VC++ which weren't in MSC way back in the day. The reason is that macro's can be changed at compile time and variables cannot, at least not without macros. Macro's provide compile time logic which variables simple can't. Macros can even be changed even from within MAKE files. These properties make macro's greater than variables even while they are less than in other respectsl. ... I will give you that macro's can be overused, and that the inherent weakness in a lack of type checking makes choosing macros on many tasks suspect.
But to say they can be replaced by const variables or protected class variables is just to stick one's head into the sand and to ignore that macro's compile time resolution gives macros an advantage over const variables which are versatile, advantageous and frankly standard in everything but the most trivial of tasks. To say using macro's is unprofessional ( as someone related second hand, not you ) is just to stand butt naked on one's desk and howl at the moon. It’s hard to take such a statement seriously... The only reasonable argument is in the degree.
I don't think I'm disagreeing too much here. I'm just answering why some header files use #define instead of const.