Michael J. Mahon wrote:
mdj wrote:
Paul Schlyter wrote:
So this bounds checking can not be turned off in Ada, for efficiency ?
It's compiler dependent - but the Ada compilers I've used allow pretty
much all runtime checking to be disabled. This is reasonable - after a
degree of testing I guess... I've personally never written anything in
Ada that ran slowly enough to bother with it.
Turning off error/assertion checking after development and test and
before distributing software for use is like wearing life vests during
training, but taking them off before going to sea (to paraphrase
Dijkstra).
Absolutely... Unless you really need the extra few cycles of speed it's
more sensible to leave it on. Some people though, would prefer that
their customer see an application crash than show a helpful error
message indicating that a programmer attempted to divide something by
zero ;-)
Even in this case, you could just compile it out per module as
required.
I've never understood why after all these years and all the fancy stuff
that's implemented in a CPU why they never grew the fairly obvious
feature of throwing an interrupt on overflow. It would mean such errors
could be trapped with zero overhead in the no error case.