title: Linux Kernel's __is_constexpr Macro
body: <p>How does the <code>__is_constexpr(x)</code> macro of the Linux Kernel work? What is its purpose? When was it introduced? Why was it introduced? </p>
  
  <pre><code>/*
   * This returns a constant expression while determining if an argument is
   * a constant expression, most importantly without evaluating the argument.
   * Glory to Martin Uecker &lt;Martin.Uecker@med.uni-goettingen.de&gt;
   */
  #define __is_constexpr(x) \
          (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
  </code></pre>
  
  <hr>
  
  <p>For a <strong>discussion on different approaches</strong> to solve the same problem, see instead: <a href="https://stackoverflow.com/questions/49480442/detecting-integer-constant-expressions-in-macros">Detecting Integer Constant Expressions in Macros</a></p>