assert

M

Malcolm

Gordon Burditt said:
If the program is in the middle of doing something physical
and important, say, flying an airplane, just halting tends to lead
to catastrophic consequences.
The aircraft should have a back-up system in case the computer crashes, just
as there should be a spare radio if that goes, a second altimeter, and so on
for every vital system it is possible to duplicate (most airliners even have
a spare pilot).
What is really deadly isn't a program that halts, but one that continues
with an error, maybe one that reports the altitude as 20 feet higher than it
really is at landing.
 
D

Dan Pop

In said:
Yes. It is not compiled when the NDEBUG macro is defined. The main purpose of
assert() is to check the design of the code.

Nope, it checks the actual implementation, not the design.

It also checks assumptions made about the implementation, when they
cannot be checked at compile time via preprocessor directives.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top