[SR-Users] A question about the code

Alex Balashov abalashov at evaristesys.com
Wed May 4 06:19:08 CEST 2016


Nathan,

I think this is actually deliberate. The return value of an assignment 
operation is always going to be true, so it's just an "overly clever" 
way of compactly setting the value of 'ret' to -2 within the same 
conditional evaluation.

The aim there is compactness, though it does obscure readability, and 
should probably be refactored into:

           if(ptr && !(VALID_CONTACT(ptr,act_time)
              && allowed_method(_m,ptr))) {
               ret = -2;
               goto done;
           }

Sometimes programmers like to do things like this because variety is the 
spice of life, but certainly, they are likely to elicit bewilderment in 
others. :-)

-- Alex

-- 
Alex Balashov | Principal | Evariste Systems LLC
1447 Peachtree Street NE, Suite 700
Atlanta, GA 30309
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/



More information about the sr-users mailing list