This page describes implementation details of the WIL error handling helpers. Apps should not rely on these details, because they are subject to change. The details are documented here to assist with debugging and to assist people who are implementing WIL itself.
The return macros generally expand to
__WI_SUPPRESS_4127_S do { ... if (some_condition(...)) { __RETURN_SOMETHING(...); } } __WI_SUPPRESS_4127_E while ((void)0, 0)
do { ... } while (0)
pattern is a standard pattern for avoiding issues with statement-like macros.while()
is while ((void)0, 0)
to attempt to avoid "conditional expression is constant" warnings. The comma operator prevents the controlling expression from being a constant expression (per the C++ language rules) and therefore avoids the compiler warning.__WI_SUPPRESS_4127_S
temporarily suppresses warning 4127: Conditional expression is constant.__WI_SUPPRESS_4127_E
restores the previous state of warning 4127.The body of the do
loop is performed with warning 4127 suppressed because the some_condition(...)
may, after compiler optimization, turn into a constant that is always true or always false.
__RETURN_SOMETHING(...)
is itself another macro that performs logging before eventually executing a return (something)
.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4