[bind10-dev] IntElement type

Shane Kerr shane at isc.org
Wed Jul 3 15:22:07 UTC 2013


On Wed, 03 Jul 2013 19:18:42 +0900 (JST)
fujiwara at jprs.co.jp wrote:

> Thanks comments.
> 
> > From: Danny Mayer <mayer at pdmconsulting.net>
> >> Which do you like better, "long long int" and "int64_t" ?
> >> 
> > 
> > Personally I find the int64_t provides an exact definition of the
> > size of the datatype. long int, long long, etc. aren't very clear.
> > On different compilers I have found the long has different meanings.
> 
> > From: Francis Dupont <fdupont at isc.org>
> > => I support Danny (who is BTW expert about a platform where
> > long is 32 bit long in both 32 and 64 bit variants).
> 
> In trac3015 branch, I implemented and tested.
> 
> [3015] Type of IntElement is changed from long int to int64_t.
>        Element::create() accepts char, short, int, long, long long,
> int32_t and int64_t. IntElement->intValue() returns int64_t.
>        IntElement->getValue() and IntElement->setValue() accept
> int64_t only.
> 
> However, strtoint64_t function does not exist.
> It is assumed that "long long" and int64_t are the same sizes.
> strtoll is used to convert string to integer.

Surely we should use boost::lexical_cast?

try {
    int64_t value = boost::lexical_cast<int64_t>(s);
} catch (bad_lexical_cast &) {
    // error handling
}

http://www.boost.org/doc/libs/1_54_0/doc/html/boost_lexical_cast.html

--
Shane


More information about the bind10-dev mailing list