Boost logo

Boost :

Subject: Re: [boost] [atomic] (op)_and_test naming
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-25 14:51:16


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.


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