### Question 5.12

I use the preprocessor macro

    #define Nullptr(type) (type *)0

to help me build null pointers of the correct type.

This trick, though popular and superficially attractive, does not buy much. It is not needed in assignments and comparisons; see question 5.2. It does not even save keystrokes. Its use may suggest to the reader that the program's author is shaky on the subject of null pointers, requiring that the #definition of the macro, its invocations, and all other pointer usages be checked. See also questions 9.1 and 10.2.

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback