RAD Studio |  |

Macros With Parameters Overview
Collapse All

This section contains Macros With Parameters Overview topics.

Topics

Name | Description
Macros With Parameters | The following syntax is used to define a macro with parameters:
Nesting Parentheses And Commas | The actual_arg_list can contain nested parentheses provided that they are balanced; also, commas appearing within quotes or parentheses are not treated like argument delimiters.
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
Converting To Strings With # | The # symbol can be placed in front of a formal macro argument in order to convert the actual argument to a string after replacement. Given the following definition:
Using The Backslash (\) For Line Continuation | A long token sequence can straddle a line by using a backslash (\). The backslash and the following newline are both stripped to provide the actual token sequence used in expansions.
Side Effects And Other Dangers | The similarities between function and macro calls often obscure their differences. A macro call has no built-in type checking, so a mismatch between formal and actual argument data types can produce bizarre, hard-to-debug results with no immediate warning. Macro calls can also give rise to unwanted side effects, especially when an actual argument is evaluated more than once. Compare CUBE and cube in the following example.

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