Don’t pass lambdas (or other multi-line entities) as parameters to macros--Raymond Chen

Not helping you.

Don’t pass lambdas (or other multi-line entities) as parameters to macros

by Raymond Chen

From the article:

Consider this macro:

#ifdef DEBUG
#define LOG(value) LogValue(value)
#else
// In production, evaluate but don't log.
#define LOG(value) (value)
#endif

This seems not entirely unreasonable, but bad things happen if you pass a multi-line entity as the macro parameter...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.