Boost logo

Boost :

Subject: Re: [boost] [atomic] (op)_and_test naming
From: Rob Stewart (rstewart_at_[hidden])
Date: 2018-01-25 21:46:52


On January 25, 2018 9:51:16 AM EST, Peter Dimov via Boost <boost_at_[hidden]> wrote:
> Andrey Semashev wrote:
>
> > It seems like the term "test" indeed implies "check if something is
> > not zero".
>
> It doesn't. Testing a _bit_ does test whether the bit is 1. Testing a
> condition does not imply that the condition "is not zero" is preferred
> over
> everything else. The x86 `test` instruction for example sets all
> condition
> codes, and it's up to the following conditional branch (jz, jnz, js,
> jns) to
> determine which one is being tested. (Ironically in the `jz` case it
> still
> tests whether a bit is 1 - the `zf` bit.)
>
> But in any event, you can't settle an empirical question by reasoning.
> It's
> either confusing (to the actual audience) or it isn't, and if it is,
> elaborate rationalizations about why it shouldn't be do not change the
> outcome. You could just avoid that whole debate by making the name
> less ambiguous.

Consistency within this domain should be sufficient. If these functions, once made consistent, are confusing, all the others using "test" will be confusing, too. All must be renamed to solve that problem.

--
Rob
(Sent from my portable computation device.)

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