# and ## in macros

Because that is how the preprocessor works.

A single ‘#’ will create a string from the given argument, regardless of what that argument contains, while the double ‘##’ will create a new token by concatenating the arguments.

Try looking at the preprocessed output (for instance with gcc -E) if you want to understand better how the macros are evaluated.

Leave a Comment

tech