On Jul 4, 2005, at 9:17 AM, Ben Laurie wrote:

Geir Magnusson Jr. wrote:

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;


I meant in C (which doesn't have superclasses).

And someone pointed out that I was wrong too, because I was just waking up and didn't have coffee... Of course you don't need the cast in my case.

I guess I was asking how pointers are typed in C...

geir
--
Geir Magnusson Jr                                  +1-203-665-6437
[EMAIL PROTECTED]


Reply via email to