harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@apache.org>
Subject Re: Security
Date Mon, 04 Jul 2005 12:44:48 GMT

On Jul 4, 2005, at 4:00 AM, Ben Laurie wrote:

> Geir Magnusson Jr. wrote:
>
>> On Jul 3, 2005, at 8:25 AM, Ben Laurie wrote:
>>
>>> Joel Neely wrote:
>>>
>>>
>>>> Typed, constrained object references vs. untyped, unconstrained   
>>>> pointers.
>>>>
>>>>
>>>
>>> C has typed pointers.
>>>
>> How are they really typed?  In Java, I'll get a runtime exception   
>> when I mis-cast...  In C, IIRC, I get long hours of debugging...
>>
>
> Cast? Why do you want to do that?

I'll take this as a straight question, although I can actually hear  
you saying it and I'm suspicious :)

I actually never understood why I do it other than for readability,  
because I do think that the runtime can figure it out.

There's a legitimate use when upcasting to a superclass.

public class Bar {
}

public class Foo extends Bar {
}

Foo f = new Foo();

Bar b = (Bar) foo;


-- 
Geir Magnusson Jr                                  +1-203-665-6437
geirm@apache.org



Mime
View raw message