Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Macros also have types. #define REGISTER_MOTOR_1_MODE 0x44 would cause REGISTER_MOTOR_1_MODE to have a type of int. The difference is more in the explicitness of the type. Commented Feb 26, 2019 at 5:34
  • @Pharap Almost... Macros do not have a type. However, the content of the macro can have either an implicit or explicit type. That type is nothing to do with the macro. Commented Feb 26, 2019 at 10:10
  • The type of the expression that the macro substitutes for is for all intents and purposes the type of the macro. Unless the macro accepts arguments then the expression will always have the same type. You can stick a macro in a decltype and get a valid type. Strictly yes, the macro is gone by the time the actual compilation phase begins, and yes, not all macros will substitute for a valid expression with a type, but the point is that if you put a macro into the code and that macro substitutes for a valid expression then the resulting value won't be 'untyped'. Commented Feb 27, 2019 at 6:19