From Jerry Coffin · 1996-04-10 16:47 · #73592 in EMULATE
On (05 Apr 96) Chris Neale wrote to Jonathan De Boyne Pollard...
CN> Hi Jonathan,
> Why should it be int?
JDBP> Because that's what the language specification says that it
JDBP> should be.
CN> Woa! But void works fine - in compiled and otherwise modes. Are we
CN> talking Turbo C++ or C here?
We're talking C++ in general. The mere fact that a compiler accepts
something does NOT mean it's legal (well formed) according to the
standard. Quite the contrary, there are all sorts of ill formed and
undefined constructs nearly every compiler will accept, though in many
cases, different compilers come up with entirely different results for
them. For instance:
x = ++x * x-- * x++ / --x;
modifies x 5 times between sequence points, making its results undefined
4 times over, but I don't know of a single compiler that'll reject it.
JDBP> Then the book (whatever book it is) is wrong.
CN> Doubt it!
Just to let you know: Jonathan is on an advisory committee for the C++
standard. He's _rarely_ wrong about what's in the C++ standard. When
he is "wrong" it's generally a situation where the C++ stnadard is self
contradictory and he hasn't noticed the contradiction previously.
Also, FWIW _most_ books on C++ are wrong about at least a few things. I
could probably count on one hand the number I've read that didn't
contain at least a few errors.
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
* Origin: Point Pointedly Pointless (1:128/77.3)