Menu

#224 Use const in public API

1.3.2
open
None
2017-10-23
2017-10-23
Michael
No

Why public API of the library does not use const where it is suitable?
It's well known a good practise to use const where it's possible. It's also annoying to use const_cast when trying to use the library from C++.
For example:

-OPENDMARC_STATUS_T opendmarc_policy_store_from_domain(DMARC_POLICY_T *pctx, u_char *domain);
+OPENDMARC_STATUS_T opendmarc_policy_store_from_domain(DMARC_POLICY_T *pctx, const u_char *domain);

Discussion


Log in to post a comment.

MongoDB Logo MongoDB