On Fri, Jul 01, 2005 at 12:25:58AM +0200, Gabriel Dos Reis wrote: > Joe Buck <[EMAIL PROTECTED]> writes: > > [...] > > | Given your biases, you might be happier with Java as a language (than C or > | C++). The Java language designers decided to strictly define many cases > | that are not defined in C (example: the order side effects is always > | strictly left to right, floating point is always IEEE, etc., integer > | overflow wraps around). There is a performance penalty for this, but > | given the "write once, run everywhere" goal it was felt that it's worth > | paying this price. > > Well, in the case of C++ I can say that the designer and original > implementor of C++ is quite amazed as to how people interpret > "undefined behaviour" in this thread.
Really? You've talked to Stroustrup? Can you be more specific? (If you're talking about the regularly repeated claim that "undefined behavior" means the compiler can delete all your files, hack your bank account, and send all your money to the GCC team, well, that's just hyperbole not to be taken seriously). > I don't think he would suggest > that people go to use Java instead. Are you claiming that Stroustrup would want to sacrifice loop optimization to make Paul happy? Undefined behavior doesn't mean that we should attempt to arbitrarily punish those who cross the line; that's why I don't think forcing integer overflows to trap (at least by default) is a good idea. In many cases, "assume no overflow, but don't trap" can produce a better result than "assume wrap" does, as in the example I gave before.