The sequence is terminated by the matching ) token, skipping intervening matched pairs of left and right parentheses.įor version (2), the number of arguments must be the same as the number of parameters in macro definition. The syntax of a function-like macro invocation is similar to the syntax of a function call: each instance of the macro name followed by a ( as the next preprocessing token introduces the sequence of tokens that is replaced by the replacement-list. Version (1) of the #define directive behaves exactly like that.įunction-like macros replace each occurrence of defined identifier with replacement-list, additionally taking a number of arguments, which then replace corresponding occurrences of any of the parameters in the replacement-list. Object-like macros replace every occurrence of defined identifier with replacement-list. If the identifier is already defined as any type of macro, the program is ill-formed unless the definitions are identical. Exceptions arise from the rules of scanning and replacement. The #define directives define the identifier as macro, that is instruct the compiler to replace most successive occurrences of identifier with replacement-list, which will be additionally processed. #define identifier (.) replacement-list (optional) #define identifier ( parameters ) replacement-list (optional) #define identifier replacement-list (optional)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |