[openssl-dev] Under-utilization of "const" in prototyping?

Philip Prindeville philipp_subx at redfish-solutions.com
Thu Dec 4 19:22:02 EST 2014


Hi all,

I was looking at some functions like ASN1_digest() or macros like 
TYPEDEF_I2D_OF() and wondering why more of the parameters that are 
unmodified aren't marked as "const", for instance "data" in 
ASN1_digest() and "type" in TYPEDEF_I2D_OF().

I started to think about doing a scrub of this, but it likely couldn't 
be done incrementally: there's too much interdependence in some of the code.

It would best be done as "throwing a switch".

How likely is this?

In most cases, changing a parameter to "const" in the API shouldn't 
affect user code, so this wouldn't break existing source using OpenSSL.

Looks like all of the code could be changed in a couple of man-days.

Is it worthwhile doing?

-Philip



More information about the openssl-dev mailing list