"Michael N. Moran" <[EMAIL PROTECTED]> writes: | Gabriel Dos Reis wrote: | > "Michael N. Moran" <[EMAIL PROTECTED]> writes: | > | And what is the meaning of code that does this: | > | | int foo(int& a) | > | { | > | int* b = &a; | > | | if(b ==0) | > | { | > | a(); | > | } | > | else | > | { | > | b(); | > | } | > According to the standard, the compiler can assume that the test is | > always false, therefore rewrite the if-else as an unconditional call to | > b(). GCC already does some null-pointer check deleting. | | Wow. I'm sure there is sound reasoning for this ... but I can't | understand what that might be given a client module could intentionally | (if ill-adviseadly) simply invoke the function:
then it gets what it deserves. Check out GCC manual for null-pointer check. -- Gaby