On 11/20/2014 10:15 AM, Maxim Uvarov wrote: > On 11/20/2014 01:49 AM, Anders Roxell wrote: >> On 2014-11-19 16:23, Mike Holmes wrote: >>> On 19 November 2014 16:13, Maxim Uvarov <[email protected]> wrote: >>> >>>> On 11/19/2014 11:21 PM, Mike Holmes wrote: >>>> >>>>> >>>>> On 19 November 2014 10:36, Yan Songming <[email protected] >>>>> <mailto: >>>>> [email protected]>> wrote: >>>>> >>>>> New API implementing odp_shm_free to match the odp_shm_reserve. >>>>> >> [...] >> >>>>> + uint64_t alloc_size; >>>>> + >>>>> + i = from_handle(shm); >>>>> + if (odp_shm_tbl->block[i].addr == NULL) { >>>>> >>>>> >>>>> Would it be better to follow the slightly better habit of reversing >>>>> the >>>>> constant with the variable >>>>> >>>>> NULL == odp_shm_tbl->block[i].addr >>>>> >>>> why is that better? I always write tested variable first. >>>> >>> http://www.drpaulcarter.com/cs/common-c-errors.php#2.2 >>> >>> Basically the reverse habit if applied uniformly removes the chance >>> of the >>> linked silly mistake, if we adopt that for ODP we will make it harder to >>> suffer from the issue. But we would have to do it uniformly for best >>> effect >>> so that during a review it catches your eye. >> +1 for Mike's suggestion. > > Thanks, that is reasonable. Sometime I really did = instead of == in the > past.
That's a matter of taste. Modern compiler will give you a warning if in the code above = is used instead of ==. Personally I prefer a direct form, because it is logical and easier to read. _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
