BIND 10 #172: cc channel - use JSON
BIND 10 Development
do-not-reply at isc.org
Wed Jun 30 08:44:22 UTC 2010
#172: cc channel - use JSON
----------------------+-----------------------------------------------------
Reporter: larissas | Owner: jelte
Type: task | Status: reviewing
Priority: major | Milestone: 05. 3rd Incremental Release: Serious Secondary
Component: msgq | Resolution:
Keywords: | Sensitive: 0
----------------------+-----------------------------------------------------
Changes (by stephen):
* owner: stephen => jelte
Comment:
Reviewed revision 2340:
__1) Review of changes made in latest update__
All changes OK.
__2) Comment about interpretation of numbers__
>>>> src/lib/cc/data.cc
>>>> count_chars_i()
>>>> from_stringstream_number()
>>>> :
>>> doh, fixed (keep dividing until < 1, i'm thinking there's a more
efficient way for this :)
>> In the code for reading characters from the string, how about reading
the next string
>> token from the stream then using boost::lexical_cast to convert it to a
number? That way
>> you can attempt to cast it to an int and, if it throws a
bad_lexical_cast exception, try
>> casting it to a double.
> hmz, relying on exceptions for expected behaviour raises all hairs in my
neck.
> But this code isn't efficient either. Perhaps this is a good example for
a micro benchmark.
I see what you mean, exceptions should be for unusual cases, not
predictable ones. In that case, how about reading the next string token
from the stream and trying strtol(): if that has not read all the
characters in the token, call strtod()?
__3) Additional review point__
One other thing related to interpretation of numbers. In my original
review I mentioned that Element::fromJSON could not cope with negative
numbers (or positive with a leading "+" sign). That was fixed, but
checking the code again, it occurs to me that it cannot cope with a
decimal number without a leading digit (e.g. ".25").
--
Ticket URL: <http://bind10.isc.org/ticket/172#comment:13>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list