On Wed, Jun 22, 2011 at 6:08 AM, Fabrizio Giudici <
[email protected]> wrote:

> On 06/22/2011 02:51 PM, Cédric Beust ♔ wrote:
>
>>
>>
>> Does this work? It looks like the compiler should be able to optimize
>> this.
>>
>>  Funny, eh? Frankly, I was unaware of the inlining problem (or I forgot
> about it). After reading the stuff, I'd say the same as you, that the
> compiler should optimize out anyway, but it indeed works.


Indeed:

    int n = null != null ? 0 : 1;

public static void main(java.lang.String[]);
  Code:
*   0:   aconst_null*
*   1:   ifnull  8*
   4:   iconst_0
   5:   goto    9
   8:   iconst_1
   9:   istore_1
   10:  return
}

Amazing, and disappointing too. If javac misses that, what else is it
missing?

-- 
Cédric

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to