Re: Assertions in principle
On 3/5/07 9:14 AM, in article 5531c0F22n0soU1@mid.individual.net, "Alf P.
Steinbach" <email@example.com> wrote:
* Greg Herlihy:
I think that a better compiler would have the asserts turned off. The
point here is that a more thoroughly-tested compiler would see no
benefit from shipping with its asserts enabled. Shipping a program
with asserts enabled can only mean that the software has not been
adequately tested. So in this case, anyone who uses g++ is
effectively participates in the product's QA.
And while such an arrangement may be reasonable for a free product
like g++, it probably won't fly for those who program with a $500 C++
As they say, that's not even wrong. $500-compilers do produce Internal
Compiler Errors. And g++'s free support is superior to e.g. Microsoft's
non-existent free support.
I see you disagree with several points that are not in my post, but it would
be interesting to know whether you take issue with anything that I actually
wrote. After all, I offered no opinion whether a $500 compiler crashes any
less often than a free C++ compiler - only that some who spends $500 on a
compiler (such as the Intel compiler) but be expecting something different
than would expect from a free compiler.
The comparison between compilers illustrates a simple point: that gcc is one
of the few programs that can justify active asserts in a shipping program.
But for the vast majority of programs - including entire categories - such
as computer games - would see no benefit at all from such a practice.
Considier how many computer games ship with asserts enabled. Any estimate?
Any estimate greater than zero? Who would prefer to have a PlayStation II
game abort because of a failed assert? How likely is it that debugging the
assert failure would be more popular than playing the games itself?
Customers who pay money for software do so with the
expectation that the software will be tested before it is shipped and
that it will run reliably after it has shipped. Leaving asserts
enabled in a shipping program has the completely opposite effect - the
asserts make the shipping program less reliable (that is, it is more
prone to fail), and all but eliminates the chances that the developers
will have tested the software before it shipped - and not just rely
on those who use the software to make up the difference.
Have you ever /used/ a commercial program?
I have used commercial programs - but I never remember using a shipping
version of a commercial program that had its asserts enabled. And until
programmers start writing software that does not fail often enough, I doubt
I'll be seeing asserts in shipping commercial software anytime soon.