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

Warren Kumari warren at kumari.net
Fri Mar 23 17:24:30 UTC 2012


On Mar 23, 2012, at 6:16 PM, JINMEI Tatuya / 神明達哉 wrote:

> At Fri, 23 Mar 2012 10:50:13 +0100,
> Michal 'vorner' Vaner <michal.vaner at nic.cz> wrote:
> 
>>>   if (10 == x) {
>> 
>> Do we really have this in our code? That looks strange to me and confusing.

Just FYI, this is common practice in some venues -- while it looks confusing, it helps prevent the:

if (x=10) { 

problem -- basically, by putting the literal first, you get a grumpy compiler then trying to assign to it…

W


> 
> Probably (hopefully) not in the latest master.  But there were some in
> the past, e.g.
> - the master immediately after #1600 was merged.  checkout 77ab7a and
>  see asiodns/dns_service.cc.
> - a previous version of trac1579.  checkout 29e01b and see
>  database.cc:findInternal().
> 
> ---
> JINMEI, Tatuya
> Internet Systems Consortium, Inc.
> _______________________________________________
> bind10-dev mailing list
> bind10-dev at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind10-dev
> 

--
Don't be impressed with unintelligible stuff said condescendingly.
    -- Radia Perlman.







More information about the bind10-dev mailing list