Lo, on Wednesday, January 2, Ben Collins did write: > Just because in C it can cause a segfault doesn't mean the other > languages are any better.
No, it doesn't. However, IMNSHO, the fact that C and C++ have many *more* undefined constructs that other languages does mean that the other languages are better (in most situations). > Show me one language that doesn't have some action that is classified > as undefined. I'm not aware of any, although PLT Scheme (http://www.plt-scheme.org/) comes pretty close. So what? I never claimed that other languages are completely defined; I simply said that the construct I mentioned up-thread has undefined behavior in C and C++, and that this lack of definition is dangerous. (The few places where PLT Scheme's behavior is undefined are also dangerous, but they arise much less frequently---when's the last time you tried to invoke a continuation from within one of dynamic-wind's guard thunks?) > Documenting that something is undefined is called a specification. Yes, in one sense, you're right. But it's a pretty useless specification. `We specify that we do not specify what this construct does.' I don't see how this is supposed to be helpful. If I had a compiler that flagged all undefined constructs at compile-time so that I didn't make them through careless errors, that would be one thing. Unfortunately, that's not possible, because you can't *detect* all of C's undefined constructs at compile-time. > It is there so you know that you cannot rely on certain behavior. If > you ignore that, then no language is going to help you. Look, I'm not trying to ignore the fact that the ANSI/ISO C spec marks certain constructs as undefined. I'm saying that the fact that they are undefined is not acceptable, especially when other languages specifically define the behavior of the analogous constructs. The fact that the behavior of these constructions is completely specified by the language means that I catch errors much earlier, whereas with C, I may not catch them at all. The main issue: I'm tired of getting bogus output with no indication that it's bogus, and I'm tired of spending long hours tracking down silly pointer bugs that aren't an issue in more sophisticated languages. The more undefined constructs in my language, the more time I have to spend doing this kind of grunt work. It's not that I want the computer to do my entire job for me, but I would like it to do some of the grunt work so I can concentrate on the interesting, challenging, and above all *useful* parts of the program. Richard