Sorry for asking very basic question. I would like to set OR condition in #ifdef directive.? How to do that ? I tried
#ifdef LINUX | ANDROID
...
..
#endif
It did not work? What is the proper way?
Sorry for asking very basic question. I would like to set OR condition in #ifdef directive.? How to do that ? I tried
#ifdef LINUX | ANDROID
...
..
#endif
It did not work? What is the proper way?
#if defined LINUX || defined ANDROID
// your code here
#endif /* LINUX || ANDROID */
or-
#if defined(LINUX) || defined(ANDROID)
// your code here
#endif /* LINUX || ANDROID */
Both above are the same, which one you use simply depends on your taste.
P.S.: #ifdef
is simply the short form of #if defined
, however, does not support complex condition.
Further-
#if defined LINUX && defined ANDROID
#if defined LINUX ^ defined ANDROID
© 2022 - 2024 — McMap. All rights reserved.
|
for "or" in your C conditionals too, you're doing it wrong. – Garpike