On 5 August 2010 11:47, Julia Lawall <julia@xxxxxxx> wrote: > On Thu, 5 Aug 2010, walter harms wrote: >> I am a bit converned about this code here: >> if (kallsyms_lookup_size_offset(addr, NULL, &offset) && offset == 0) >> >> offset is set inside kallsyms_lookup_size_offset(), right ? >> but can you guarantee that the calling sequence is the same on all processors ? >> (it is not in case of functions). > > && should always be evaluated lazily from left to right. Otherwise > x != NULL && x->y == z wouldn't be safe. > The && operator triggers a sequence point. I do not have access to the standard (ISO/IEC 9899:1990) any longer, so the following is from a draft (but in case the text changed, there are no functional differences for this): 2.1.2.3 Program execution ... At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place. ... 3.3.13 Logical AND operator ... Unlike the bitwise binary & operator, the && operator guarantees left-to-right evaluation; there is a sequence point after the evaluation of the first operand. BR Håkon Løvdal -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html