Skip to main content

Java - the C/C++ inheritance

Posted by rags on June 28, 2004 at 5:05 PM PDT

Interestingly, in many of my JavaOnes, this was the first time
I attended the chat. I was disappointed that there was no fire anywhere.
However, the energy level was very high and I enjoyed the discussions.
The JavaOne Alumni is a very robust and influential community.

Of all the questions, the one that struck me most, was the
intertwining of Java and the C/C++ language. Obviously, many
of us in the Java community did take the C/C++ route and
sometimes wish for some of the esoteric feautures of C/C++
that we miss.

When I joined Sun, I had a discussion with James Gosling
about the fact that I loved STL and when would templates be
incorporated in Java. I am glad that a much
improved version of templates i.e. generics is in Java.

However, it also reminded me of some of the pitfalls. I
quickly typed in a piece of C/C++ code.


#include <stdio.h>
main()
{
    if ( (unsigned) 0 < -2)
        printf("C is falling apart\n");
}

If you're able to guess the answer for this and realize
why, you may probably agree with me that the unsigned
is abused more than used appropriately.

I hope that Java continues to be relatively small, elegant and harder
to commit mistakes. Thoughts?

Rags