RAD Studio |  |

Token Pasting With ##

You can paste (or merge) two tokens together by separating them with ## (plus optional whitespace on either side). The preprocessor removes the whitespace and the ##, combining the separate tokens into one new token. You can use this to construct identifiers.

Given the definition

Copy Code

    #define VAR(i, j) (i##j)

the call VAR(x, 6) expands to (x6). This replaces the older nonportable method of using (i/**/j).

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!