[gnutls-devel] GnuTLS | Mark arguments of function gnutls_x509_crt_equals2 as const (!1000)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Tue May 21 15:26:06 CEST 2019




> But I have some concerns about change to asn1_find_node function signature in the linked MR.

'const' is a promise to the caller that the callee doesn't change it's contents (resp. the memory region a pointer points to) via this pointer. And in this it is absolutely fine to take a const argument and return  a non-const, even if they both have identical values. The caller knows 'callee didn't change my data', but also the caller should be able to decide on it's own if the returning pointer is const or not. To avoid forcing the caller to use a cast, `asn1_find_node` returns a non-const value. The promise has been fullfilled by callee and after returning there is no promise any more.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/1000#note_172795892
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190521/06da5d36/attachment.html>


More information about the Gnutls-devel mailing list