[openssl-dev] [EXTERNAL] Re: [openssl.org #4473] Compile errors when compiling with C++ compiler

Sands, Daniel dnsands at sandia.gov
Thu Mar 24 17:55:38 UTC 2016


On Thu, 2016-03-24 at 01:08 -0400, Jeffrey Walton wrote:

Lack of relevance.  C++ is NOT C.  There many subtle and not so subtle
differences.  OpenSSL is written in C.  Use a C compiler.



'make -k' is telling me its a little more than (ir)relevance. 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
                                                     ^
crypto/asn1/asn_mime.c:443:46: warning: deprecated conversion from
string constant to ‘char*’ [-Wwrite-strings]
         prm = mime_param_find(hdr, "boundary");
                                              ^
crypto/asn1/asn_mime.c:468:57: 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.



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.  And with the appropriate -W's, even gcc will warn you about such use.  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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20160324/62dd3595/attachment.html>


More information about the openssl-dev mailing list