4. const uses an ordinary constant name, and define can use an expression as the name. For example:
5. const can only accept static scalars, while define can use any expression. For example:
6, const Always case-sensitive, however define() can define case-insensitive constants via the third argument. For example:
From the above example, we get, const is simple and easy to read. It is a language structure in itself, while define is a method. Defining with const is much faster than define at compile time. As for which one to use, it depends on your own needs. |