Preprocessor Abuse and Optional Parentheses

Mike Ash: While coming up with macros that would justify this [UNPAREN()] construct, I built a nice dispatch_once macro for making lazily-initialized constants. Here it is: #define ONCE(type, name, …) \ UNPAREN(type) name() { \ static UNPAREN(type) static_ ## name; \ static dispatch_once_t predicate; \ dispatch_once(&predicate, ^{ \ static_ ## name = ({ __VA_ARGS__; }); … Continue reading Preprocessor Abuse and Optional Parentheses