|
|
1.1 ! root 1: ! 2: ! 3: ## Preprocessing Operator ## ! 4: ! 5: ! 6: ! 7: ! 8: Token-pasting operator ! 9: ! 10: ! 11: The preprocessing operator ## can be used in both object-like and ! 12: function-like macros. When used immediately before or im- ! 13: mediately after an element in the macro's replacement list, ## ! 14: joins the corresponding preprocessor token with its neighbor. ! 15: This is sometimes called ``token pasting''. ! 16: ! 17: As an example of token pasting, consider the macro: ! 18: ! 19: ! 20: #define printvar(number) printf("%s\n", variable ## number) ! 21: ! 22: ! 23: When the preprocessor reads the following line ! 24: ! 25: ! 26: printvar(5); ! 27: ! 28: ! 29: it substitutes the following code for it: ! 30: ! 31: ! 32: printf("%s\n", variable5); ! 33: ! 34: ! 35: The preprocessor throws away all white space both before and ! 36: after the ## operator. This gives you an easy way to print any ! 37: one of a set of strings. ! 38: ! 39: ## must not be used as the first or last entry in a replacement ! 40: list. All instances of the ## operator are resolved before fur- ! 41: ther macro replacement is performed. ! 42: ! 43: For more information on object-like and function-like macros, see ! 44: #define. ! 45: ! 46: ***** See Also ***** ! 47: ! 48: #, #define, C preprocessor ! 49: ! 50: ***** Notes ***** ! 51: ! 52: Token pasting has been performed by separating the tokens to be ! 53: pasted with an empty comment, but this is no longer necessary. ! 54: ! 55: The order of evaluation of multiple ## operators is unspecified. ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.