In my experience in C++ I have seen it said many times that:
1) C constants are not true constants but C++ constants are (can't use them as size of an array etc.)
2) In C++ const int is preferable to #define for its type safety, scoping and other benefits.
I also thought that I had seen in my previous work that const int data or static const int class data would be "compiled out", especially when using optimization settings, so that it would not use memory to allocate those constants (unless possibly the address of the variable was used).
Recently I am trying to demonstrate this as we move to C++ and I have not found a way to achieve this. It seems that all variables that are switched from #define to const int seem to consume memory. I have tried changing the optimization settings on the files where they are used and I have not seen any change in behavior.
Is there a way to avoid memory allocation for these? It seems unnecessary..
Thanks
Chris