Boost logo

Boost :

Subject: Re: [boost] My Beast Review
From: Nik Bougalis (nikb_at_[hidden])
Date: 2017-07-11 23:17:32


On Sun, Jul 9, 2017 at 11:45 AM, Phil Endecott via Boost
<boost_at_[hidden]> wrote:

> Could it be that the reason why the scope of the library seems so limited
> is that Vinnie has spent his time fiddling with this optimisation, rather
> than adding useful features?

I don't find this kind of comment to be constructive or helpful in a
review context. Vinnie had a concept about what the library should be
and spent considerable time and effort designing it. He's repeatedly
stated that he wanted something limited in scope and explained his
rationale behind that. I'm sure he presented the best design he could
come up with. To suggest that the limited scope is, instead, because
you feel he micro-optimized something you don't think should be
micro-optimized seems petty.

> Test for is_digit:
>
> #include <cctype>
>
> bool is_digit_1(char c)
> {
> return static_cast<unsigned char>(c-'0') < 10U;
> }
>
> bool is_digit_2(char c)
> {
> return c >= '0' && c <= '9';
> }
>
> bool is_digit_3(char c)
> {
> return std::isdigit(c);
> }
>

Your criticism of custom reimplementations of things like isdigit
isn't entirely off the mark. Such things should be avoided almost
always, and when reimplemented, there should be a clear and convincing
reason. Maybe that's the case here, maybe it isn't - that's a
legitimate concern and a fair one to bring up.

But have you considered, for example, the fact that std::isdigit can
return true for digits other than 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?
According to cppreference, "some implementations (e.g. Microsoft in
1252 codepage) may classify additional single-byte characters as
digits"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk