[torquedev] pbm_mom segfault in TMomCheckJobChild
jbernstein at penguincomputing.com
Wed Dec 17 15:41:23 MST 2008
Garrick Staples wrote:
> On Tue, Dec 16, 2008 at 07:18:24PM -0500, Glen Beane alleged:
>> On Tue, Dec 16, 2008 at 7:17 PM, Glen Beane <glen.beane at gmail.com> wrote:
>>> On Tue, Dec 16, 2008 at 3:06 PM, Joshua Bernstein
>>> <jbernstein at penguincomputing.com> wrote:
>>>> if (i == -1)
>>>> if (errno == EINTR)
>>>> The ordering is important. Otherwise the compiler sees if (a && b)
>>>> and is allowed to look at 'b' first to handle short-circuit evaluation.
>>> I would NEVER use such a brain dead compiler. Compound Boolean
>>> expressions are evaluated left to right.
>>> if (ptr == NULL && ptr->foo == bar) is never going to access a null
>>> pointer because a correct compiler is never going to do the ptr->foo
>>> == bar test first.
>> i mean if (ptr != NULL && ptr->foo == bar)
> According to the C faq (a reference that I deeply trust), these constructs are
> perfectly legal. The || and && operators (and the ?: and comma operators)
> create sequence points between the operands and gaurantee the order of
Ah well. I stand corrected about the ordering issue. Though the fact
later on that errno is assigned even if the read() call didn't fail
More information about the torquedev