Open nerd4code-git opened 7 months ago
CC @AaronBallman
Can/should we use the #pragma push_macro
/#pragma pop_macro
extension to make the current approach bug-free?
Can/should we use the
#pragma push_macro
/#pragma pop_macro
extension to make the current approach bug-free?
We could, but I think it's probably better to change the way we expose the macros to be more resilient instead.
Clang’s freestanding
<stdint.h>
uses the__
[U
]INTxx_C_SUFFIX__
predefines to construct literals in theINTxx_C
macros it defines. This requires the -C_SUFFIX__
predefines to be fully expanded; e.g., viaUnfortunately, this means if I
the
INTxx_C
macro will attempt to token-paste%
onto the literal.Ideally the user should be able to define unprefixed one-to-three-letter macro names without breaking core functionality. My suggestion would be to do what GCC does, and define pre-fabricated
__INTxx_C
macros instead or in addition to the lone suffix macros, and then you could paste without preexpansion.