Maintained by: NLnet Labs

[Unbound-users] passing string literals in C++

Karel Slany
Mon Jun 17 17:40:41 CEST 2013


Hello,

I've recently bumped into lots of annoying messages about deprecated
conversion from string constant to 'char*' when I was using libunbound
with C++.

Apparently, functions in <unbound.h> can safely handle const char*
parameters, but they are declared and defined to take char*. This
represents no problem in C. But in C++ string literals are considered
const char*.

If there is no reason for declaring those functions with char* arguments
I would suggest to change the function prototypes to take const char*
arguments. The suggested patch is in the attachment.

Best regards,
K.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unbound_const_strings.diff
Type: text/x-patch
Size: 8914 bytes
Desc: not available
URL: <https://unbound.nlnetlabs.nl/pipermail/unbound-users/attachments/20130617/fddc4ca2/attachment.bin>