, 1999 ++. STL ++, , , . , .
++ Java. , , ( ).
Java - -, JVM. JVM (), , , , java.lang.NullPointerException.
JVM , JVM SEGFAULT - , de-referencing ( C ++, Pascal, Ada, Assembly BASIC, PEEK/POKE .)
( , ) ++ ( , ) , ( , ) . , true, . . ( , , ) .
Java
if( myPossiblyBadReference == null )
{
throw java.lang.NullPointerException( "you suck!" );
// or throw my.own.NPEException(); // preferably a specialization of NullPointerException
}
else
{
doYourThingieWith( myPossiblyBadReference );
}
- ++, , ++ 0x ( ). , , , ++.
In other words, there is much more elbow lubrication involved in getting these things. Remember that you are working at a lower level of abstraction from the one provided by the JVM.
The JVM is a barrier that gives you many good error handling capabilities (which we typically rely on Java developers). These error handling capabilities should be explicitly encoded when you are working with lower (not only in C ++.)