Prev: Learning try throw catch.
Next: redirect std::cout
From: Alf P. Steinbach on 27 Apr 2010 13:33 * Ulrich Eckhardt: > Francis Glassborow wrote: >> Ulrich Eckhardt wrote: >>> One of the most important things IMHO: It [Python, Java] doesn't >>> have things like undefined behavior, as C and C++ do. > [...] >> I think that is an over-statement. Java certainly has undefined >> behaviour just much less of it and I am pretty certain Python does as >> well. > > The "much less" is exactly the point. I at least haven't crashed either VM > yet, though my main work involves C++, not one of those two. You're not a good at crashing things then. I've reported at least two bugs crashing the CPython VM, and I've only toyed with it (extremely small toy example programs) for half a year or so. I can't recall the Java VM ever crashing but there are enough of bugs in Java too. Nothing's perfect. However, for the beginner it's a challenge to use a language like C or C++ where so much can go wrong even with the simplest small example programs. Cheers, - Alf
From: Keith Thompson on 27 Apr 2010 15:56
"Alf P. Steinbach" <alfps(a)start.no> writes: > * Ulrich Eckhardt: >> Francis Glassborow wrote: >>> Ulrich Eckhardt wrote: >>>> One of the most important things IMHO: It [Python, Java] doesn't >>>> have things like undefined behavior, as C and C++ do. >> [...] >>> I think that is an over-statement. Java certainly has undefined >>> behaviour just much less of it and I am pretty certain Python does as >>> well. >> >> The "much less" is exactly the point. I at least haven't crashed either VM >> yet, though my main work involves C++, not one of those two. > > You're not a good at crashing things then. > > I've reported at least two bugs crashing the CPython VM, and I've only toyed > with it (extremely small toy example programs) for half a year or so. > > I can't recall the Java VM ever crashing but there are enough of bugs > in Java too. > > Nothing's perfect. > > However, for the beginner it's a challenge to use a language like C or > C++ where so much can go wrong even with the simplest small example > programs. And where a small program with a blatant error can appear to run correctly. #include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { #define GREETING "hello, world" char *message = malloc(strlen(GREETING)); strcpy(message, GREETING); puts(message); free(message); return 0; } (The problem: I didn't allocate space for the terminating '\0'.) -- Keith Thompson (The_Other_Keith) kst-u(a)mib.org <http://www.ghoti.net/~kst> Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" |