on 05/12/2008 09:22 Ed Schouten said the following: > * Maksim Yevmenkin <maksim.yevmenkin_at_gmail.com> wrote: >> the idea was to ensure that kbd->kb_locked variable only takes values >> 0 (zero) and 1 (one). > > I often use constructs like these to do that: > > foo = bar ? 1 : 0; > > Maybe !!bar is a lot shorter to write, I think the line above is a lot > easier to read. Another variation is: foo = (bar != 0); I think that this is something in the middle. BTW, gcc 4.2 produces exactly the same assembly for all 3 forms. -- Andriy GaponReceived on Fri Dec 05 2008 - 10:35:57 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:38 UTC