title: Preventing compilation of void** pointer arithmetic in C
body: <p>This is the same concept as <a href="https://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c">Pointer arithmetic for void pointer in C</a> except my data type is a <code>void**</code> instead of a <code>void*</code></p>
  
  <pre class="lang-c prettyprint-override"><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  
  int main() {
      int foo [] = {1, 2};
      void* bar = &amp;foo;
      void** baz = &amp;bar;
      void** bazplusone = baz + 1;
  
      // cast to void* to make printf happy
      printf("foo points to %p\n", (void*)foo);
      printf("baz points to the address of bar and is %p\n", (void*)baz);
      printf("bazplusone is an increment of a void** and points to %p\n",(void*)bazplusone);
      return 0;
  }
  </code></pre>
  
  <p>which results in the following output for my version of gcc:</p>
  
  <pre><code>foo points to 0x7ffeee54e770
  bar is a void* cast of foo and points to 0x7ffeee54e770
  baz points to the address of bar and is 0x7ffeee54e760
  bazplusone is an increment of a void** and points to 0x7ffeee54e768
  </code></pre>
  
  <p>I have two questions:</p>
  
  <ol>
  <li>Is this legal according to the C standard?</li>
  <li>Assuming #1 is
  false, is there a way to generate a compiler error? Neither
  <code>-pendandic-errors</code> nor <code>-Wpointer-arith</code> complains about this small
  program</li>
  </ol>