Maintained by: NLnet Labs

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

Ondřej Surý
Tue Jun 18 10:04:08 CEST 2013


Hi Wouter,

could you just check the availability of __cplusplus >= 199711L and or C99
support (either by using macro or from autoconf) and use something like:

#ifdef C99_or_CXX11_pseudo_macro
#define UB_CONST const
#else
#define UB_CONST
#endif

and use:

int ub_function(UB_CONST char *);

?


On Tue, Jun 18, 2013 at 9:43 AM, W.C.A. Wijngaards <wouter at nlnetlabs.nl>
wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Karel,
>
> Thanks for the patch.  I wanted the initial header file to use the
> least language constructs as these give rise to portability and
> parsing issues (such as types, 'pid_t').  This is why all the numbers
> are passed as 'int'.  const seems to be 'C99' and posix :-)
>
> Best regards,
>    Wouter
>
> On 06/17/2013 05:40 PM, Karel Slany wrote:
> > 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.
> >
> >
> >
> > _______________________________________________ Unbound-users
> > mailing list Unbound-users at unbound.net
> > http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users
> >
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.13 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJRwA+wAAoJEJ9vHC1+BF+NkDoP/AyvcMYzc17x4PQaVB7yL+j7
> M2CvkcOa52pyyQOHP9oHiwvjsIEPhiDsvkjTVOp40iXUdFbwzvxSUwxHjThNFNPc
> IvkDuN4lNKhiOGNMDXsZaxkMf8QLo7SraVV+pxR6gCJNsfoZiNBtAyBiwJFAZse6
> IrrMBWpP56DvV7RNc0TsbWQ00aJVGVm6N3ZnmiDuqQscn7vxAycEvq+qrKjrGaqG
> mkFMLAyn3+upt7wKrFeMQ64/g7i+9LE4y/fbBlNi8AmtpCB9SJ9lgW6VWOvdqwXc
> AGtM/ywiEXFjjLxX0+c2eDtH9WyldCJQN3V6VM1R0OSyBf4CDfGxW0fiieLWzc8Q
> mrAjZNkivpfiUx14RgYTSPK8vP9cWpSmcYo2s+F6U6V1FLB0OhzVqB1HD44cbrCt
> X5gGfjPfgfZTsfOBqUDPm/58Q4s0AtDAUExibHaM6va5C5HBmIliiry71+a5rLAW
> lZh1mircczksqrh5OKImE9bh7Q9/XdIcISO/nqVD8rObKWRJnrywXtxpjUeeI20W
> mNljTnDTp7b5/WEXHuk0lpB+O146vdZFjtfPemwJDCQ4j/RiFe+I/trzZxk/zVdh
> RnX8g1nd0odx7EgZSA6m7qzYg8R3sJYOwRAyiDFXQgz5LICiG2Vqm4rku4ABWnu5
> m711FLJz0f1/BsMVyA1q
> =rQCa
> -----END PGP SIGNATURE-----
> _______________________________________________
> Unbound-users mailing list
> Unbound-users at unbound.net
> http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users




--
Ondřej Surý <ondrej at sury.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://unbound.nlnetlabs.nl/pipermail/unbound-users/attachments/20130618/5b40ceac/attachment.html>