Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An example of the use of function-like macros to create type-generic functions is shown in MEM02-A. Immediately cast the result of a memory allocation function call into a pointer to the allocated type.

Type-generic macros may also be used, for example, to swap two variables of any type, provided they are of the same type.

PRE00-EX5: Macro parameters exhibit call-by-name semantics, whereas functions are call by value. Macros must be used in cases where call-by-name semantics are required.

...