Constant vs. #define Macro

Hey everyone,

I know nowadays in C++ programming, using #define macros to define a constant is generally frowned upon, and the strong preference is to use constants.

Is there any reason in an Arduino library why a #define Macro may be better, faster, or more efficient than a constant?

If it matters, I am talking about unsigned short ints, or short ints.

Thanks.

NJavrGuy:
Is there any reason in an Arduino library why a #define Macro may be better, faster, or more efficient than a constant?

None that I can see, except when the code was written by somebody who has a personal preference for using #defines because that's what they are used to using.

A "#define" could be overwritten without error.
A "const int" can not be overwritten with a different value.
And the compiled sketch has the same size.

NJavrGuy:
Is there any reason in an Arduino library why a #define Macro may be better,

See above plus a macro can be used in conditional compilation (#if #ifdef).

faster,

No.

or more efficient than a constant?

No.

If it matters, I am talking about unsigned short ints, or short ints.

It does not.

const is generally a better choice because it includes type.