<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000099">
    On 24/03/2016 17:55, Sands, Daniel wrote:<br>
    <blockquote cite="mid:1458842180.17024.6.camel@sandia.gov"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div>On Thu, 2016-03-24 at 01:08 -0400, Jeffrey Walton wrote:</div>
      <blockquote type="cite">
        <pre>I see
some stuff going on that's not allowed in C++, but its dodgy in C. For
example:

crypto/asn1/asn_mime.c: In function ‘ASN1_VALUE* SMIME_read_ASN1(BIO*,
BIO**, const ASN1_ITEM*)’:
crypto/asn1/asn_mime.c:432:53: warning: deprecated conversion from
string constant to ‘char*’ [-Wwrite-strings]
     if ((hdr = mime_hdr_find(headers, "content-type")) == NULL
                                                     ^
In the absence of a compensating control to catch these kinds of
mistakes, maybe the project should consider a modern C++ compiler as a
quality gate.

</pre>
      </blockquote>
      <div>Just a note about this particular issue:  It's not unique to
        C++.  Even the C standard proscribes use of character string
        constants as char*'s.</div>
    </blockquote>
    <br>
    That's not correct. In C string literals are static arrays of items
    of type char, so char* is appropriate to access them. They have the
    added ugly restriction that attempting to modify them results in
    undefined behaviour, which does not exactly match their type. They
    were not defined as arrays of const char to be more easily
    compatible with pre-existing library APIs.<br>
    <br>
    <blockquote cite="mid:1458842180.17024.6.camel@sandia.gov"
      type="cite">
      <div> And with the appropriate -W's, even gcc will warn you about
        such use.</div>
    </blockquote>
    <br>
    Just in case you're code might be using them to modify the literal.<br>
    <br>
    <blockquote cite="mid:1458842180.17024.6.camel@sandia.gov"
      type="cite">
      <div>  With another -W that I can't be bothered to look up at the
        moment, it will even warn you that explicit casts from const x
        to x are taboo, since your constant may be optimized in a way
        that conflicts with your attempted use.<br>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">
-- 
J. J. Farrell
Not speaking for Oracle
</pre>
  </body>
</html>