Null pointer check elimination

Gabriel Dos Reis gdr@integrable-solutions.net
Mon Nov 14 20:42:00 GMT 2005


"Michael N. Moran" <mike@mnmoran.org> 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.
-- Gaby


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /