[ros-dev] gcc problem or not
Mark Junker
mjscod at gmx.de
Wed May 4 00:43:33 CEST 2005
Hartmut Birr schrieb:
>You are right, but I've still assumed that the pointer is zero or valid.
>The real problem is, that gcc doesn't stop to validate an expression if
>the result is determined and if the expression consist of simple
>expressions which are combined with OR.
>
>
Does this also happen when using something like the following?
if (p!=NULL && p->val==0) {
}
I would assume that GCC's optimizer realizes that your (not mine above)
sample code is just some kind of switch statement that can be heavily
optimized. This kind of optimization (-> switch) is ok in this situation.
And I have to admit that the optimization is quite good because it
avoids a conditional jump.
Regards,
Mark
More information about the Ros-dev
mailing list