Re: [vpp-dev] Coding Preference Question

2017-02-23 Thread Burt Silverman
​Spend some time with C++ and it becomes more obvious that ~0 and -1 are the same thing: 0 is an integer, and ~0 is also an integer, with the bits flipped, and -1 is an integer with the same bit pattern as ~0. So if the intent is to have an unsigned int with the same bit pattern as ~0 or -1, the w

Re: [vpp-dev] Coding Preference Question

2017-02-23 Thread Dave Barach (dbarach)
If the value could be construed as a pool index - e.g. a sw_if_index - I always use u32 and ~0... Thanks… Dave From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On Behalf Of Jon Loeliger Sent: Thursday, February 23, 2017 5:03 PM To: vpp-dev Subject: [vpp-dev] Coding

[vpp-dev] Coding Preference Question

2017-02-23 Thread Jon Loeliger
VPPers, As a general rule, do you guys prefer to use: 1) An integer (i32) and -1 as a flag case, or 2) An unsigned integer (u32) and ~0 as the flag case? If it matters, this is for an API value. Thanks, jdl ___ vpp-dev mailing list vpp-dev@lis