title: Ensure returned pointer is const, without throwing warnings
body: <p>My goal is to define a clean API for my library.<br>
  One of my function returns a pointer that shall not be modified with pointers arithmetic.<br>
  To do so at compile-time, I was planning on using the <code>const</code> keyword in the function prototype.</p>
  
  <p>Here's a naive example:</p>
  
  <pre><code>int global_var = 12;
  
  int* const access_global_var(){ return &amp;global_var;}
  
  int main(void) {
    int* const ptr = access_global_var();
  
    *ptr = 15;  //&lt; Should be valid 
    ptr++;      //&lt; Should be Invalid 
    return 0;
  }
  </code></pre>
  
  <p>It works as expected: the compiler throws an error at <code>ptr++;</code>.   </p>
  
  <p><strong>Problem:</strong><br>
  When compiling with the <code>-Wextra</code> clang/gcc flag, I get the following warnings:</p>
  
  <pre class="lang-c prettyprint-override"><code>warning: 'const' type qualifier on return type has no effect
  </code></pre>
  
  <p>Is this warning correct? Is there something I'm missing? Is there a better way to achieve what I'm trying to do?<br>
  As warnings are treated errors in my project, this is, as you can expect, problematic.<br>
  Thanks</p>