Advantages of const over #define. When to use which of them?
const means the data can't be changed while define has no such meaning.
const is used by compiler and define is performed by pre-processor.
const has scope while define can be considered global.
const variable can be seen from debugger while macro can be seen.
const guarantee the type which macro can't (type checking)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment