Re: mixed-sign arithmetic and auto
James Dennett wrote:
Walter Bright wrote:
James Dennett wrote:
Walter Bright wrote:
Jerry Coffin wrote:
A design like you're advocating
that makes it easy for a bug to exist for years before it's even
noticed
almost inevitably _increases_ engineering costs by a huge margin.
You're the first I've ever heard claim that undefined behavior reduces
bugs, even by a "huge margin". I think it's an extraordinary claim.
It's likely true.
Sorry, I'm not buying it. How many bugs have you found in your code that
were exposed by UB that would still have been bugs without UB?
Hundreds, at a guess. Bugs that have been hidden when porting
between similar compilers/platforms but were exposed by others.
If the defined behavior had been that of the common platforms,
the bugs would have stayed hidden. Running tests across a wide
variety of platforms has brought to light many, many latent bugs.
As you yourself acknowledge, no test suite for a complex system
is complete; running it in different configurations across
platforms which have different behaviours helps to fill in some
of the gaps.
Sorry, I'm not buying it either. This is circular logic as it only works
for a self-serving definition of a bug ("forgetting to code around an UB
properly").
I don't think it should be necessary to argue the bads of UB in this
forum. It can only mean the discussion has meandered to a point where
some fundamentals have been forgotten for the sake of the argument.
(I have some family friends who've had a son-in-law imprisoned. Our
families got to talk about it during a party, and the man's
mother-in-law said that he's doing great, he's in charge with the radio
amd TV broadcast for the prison, he's getting good food, preferential
visits, the works. She was very cheery about it all. It all sounded
great, but my Dad put the finger on the issue. He said: "Wait a
minute... she makes it sound like it's good to be in prison.")
So wait a minute there. Undefined behavior is not good. We understand
the necessity to tolerate it "for the greater good" (to quote a funny
British movie), but it's not good.
Andrei
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]