[squid-dev] [PATCH] YesNoNone class updates

Kinkie gkinkie at gmail.com
Tue Jan 12 09:52:14 UTC 2016


Hi,
  I like the intent, IMO there's a bit of room for improvement in two areas:

- the note about memset(0) in SquidConfig, but that' s something to be
fixed in SquidConfig, not here
- since we use c++11 here, it could be worth to specify the storage
class in the (private) enum, and not to rely as much on enum <-> int
equivalence.
In other words (e.g., and build-tested):
class YesNoNone {
    //...
    enum YNNValue : int8_t { optDisabled = -1, optUnspecified = 0,
optEnabled = 1 } ;
    YNNValue option; ///< configured value or zero
    //...
};

These are non critical however.

On Tue, Jan 12, 2016 at 2:36 AM, Amos Jeffries <squid3 at treenet.co.nz> wrote:
> Update class YesNoNone to use C++11 features which allow better boolean
> conversion, assignment, copy, and move ctors.
>
> Distinction is made between implicit and explicit configuration. If the
> class is implicitly initialized to some default value it can be used to
> test for that value without asserting, but the configured() accessor
> indicated false.
>
> Fixes one bug with the enum values where the memset() done to clear the
> SquidConfig global settings would set all YesNoNone members to Disabled
> instead of Unspecified.
>
> Adds unit tests of the basic class functionality. Though no failure
> cases are known yet that can be tested with cppunit, so none of those yet.
>
> Amos
>
> _______________________________________________
> squid-dev mailing list
> squid-dev at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-dev
>



-- 
    Francesco


More information about the squid-dev mailing list