Menu

Token concat

Cyder

Token Concat

Commonly known as the ## (Hash-Hash) operator, it can be used, to erase whitespace between 2 tokens.
Please note, that TPP has stricter rules for where the operator is allowed, only allowing it in macro function, where at least one operand of the operator is a function parameter and the other being an identifier or integral constant.

Note, that similar to the Stringize operator, function arguments are not expanded before concantation.

#define CAT(a,b) a ## b
#define CAT_(x) _ ## x
#define NO_CAT() 10 ## 20
#define CAT_2(a,b) CAT(a,b)

#define foo 42

CAT(10,20) // Expands to [1020]
CAT_2(foo,00) // Expands to [4200]
CAT_(foo) // Expands to [_foo]
NO_CAT() // Expands to [10][ ][##][ ][20]

s.a. [Bracket notation]
s.a. [Stringize operator]


Related

Wiki: Bracket notation
Wiki: Stringize operator

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.