Timeline for Logical AND (&&) does not short-circuit correctly in #if
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
yesterday | audit | First answers | |||
yesterday | |||||
Jul 1 at 12:24 | audit | First answers | |||
Jul 1 at 12:24 | |||||
Jun 30 at 23:50 | comment | added | Jonathan Leffler |
@Harith: The C23 draft standard has an 'EXAMPLE 2' that illustrates: /* Fallback for compilers not yet implementing this feature. */ — #ifndef __has_c_attribute — #define __has_c_attribute(x) 0 — #endif /* __has_c_attribute */ — #if __has_c_attribute(fallthrough) — … — #endif . A similar operation could be used for __has_include (and __has_embed ).
|
|
Jun 30 at 13:56 | history | edited | dbush | CC BY-SA 4.0 |
added 293 characters in body
|
Jun 30 at 13:56 | vote | accept | Harith | ||
Jun 30 at 13:54 | comment | added | Eric Postpischil |
@Harith: Use nested #if directives.
|
|
Jun 30 at 13:54 | history | edited | dbush | CC BY-SA 4.0 |
added 180 characters in body
|
Jun 30 at 13:53 | comment | added | Harith |
Interesting. How then do I write #if defined(__has_include) && __has_include(<stdbit.h>) in a manner that wouldn't cause compilation failure if the macro __has_include was not defined?
|
|
Jun 30 at 13:51 | history | answered | dbush | CC BY-SA 4.0 |