[bind10-dev] [bikeshed] "variable == value" vs "value == variable"

Michal 'vorner' Vaner michal.vaner at nic.cz
Fri Mar 23 09:50:13 UTC 2012


Hello

On Thu, Mar 22, 2012 at 11:10:38AM -0700, JINMEI Tatuya / 神明達哉 wrote:
>    if (10 == x) {

Do we really have this in our code? That looks strange to me and confusing.

I know we have EXPECT_EQ(10, x), and it's because of the formatting of output.

I could imagine there are cases where it could be more readable this way (like
(10 < x && x < 20), but generally I don't think this is a good idea. Even less
in C++, because I'd ask if there was a specific reason to use this unusual
construction instead of normal one, for example because == is defined
asymmetrically for the given types.

With regards

-- 
When a fly lands on the ceiling, does it do a half roll or a half loop?

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20120323/1f2838cb/attachment.bin>


More information about the bind10-dev mailing list