[openssl-dev] Under-utilization of "const" in prototyping?
Kurt Roeckx
kurt at roeckx.be
Thu Dec 4 19:30:30 EST 2014
On Thu, Dec 04, 2014 at 05:22:02PM -0700, Philip Prindeville wrote:
> 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?
I would like to see such changes. We've been slowly adding more
const, but it could always use more of them. So feel free to send
a patch.
Kurt
More information about the openssl-dev
mailing list