Re: Assertion vs Exception Handling
On Mar 12, 10:36 am, "Leigh Johnston" <le...@i42.co.uk> wrote:
"James Kanze" <james.ka...@gmail.com> wrote in message
news:3494792b-bcd9-4426-a762-3701ff3673ae@y17g2000yqd.googlegroups.com...
On Mar 9, 3:32 am, DT <dongta....@gmail.com> wrote:
1. I have a long array and I want to check element of the array fails
my test, for example:
Just
assert(a[i] == 0);
But most of the time, assertions will be active in released
code.
Sigh. What do you mean most of the time?
I mean most of the time in programs written by professional
programmers, using well established techniques for project
management.
Obvious, hobby programmers have their own rules, with which I'm
not familiar.
We have been over this before.
Yes. The issue is pretty well established, and well documented
in the appropriate literature.
By default assert does nothing in release mode which is the
way it should be.
There is no real default, or at least not one applicable to any
real applications. Every application will decide what to do
with regards to all of the compiler options. Of course, the
very fact that one speaks of a "release mode" suggests
unprofessionalism. If at all possible, you "release" the code
you've tested, and there aren't different modes. (And when not
possible, there may be more than just two modes.)
--
James Kanze