comp.lang.ada
 help / color / mirror / Atom feed
From: mfb@mbunix.mitre.org (Michael F Brenner)
Subject: Re: constraint-errors
Date: 1996/10/07
Date: 1996-10-07T00:00:00+00:00	[thread overview]
Message-ID: <53bidr$en6@linus.mitre.org> (raw)
In-Reply-To: DywwM1.F8K.0.-s@inmet.camb.inmet.com


: Can someone please give me some general advice on what causes
: constraint-errors?
:: Here are the most common causes:
::
:: 1) Attempting to dereference a null pointer
:: 2) Indexing beyond the end of an array
:: 3) Choosing a field of the "wrong" variant of a record
:: 4) Going outside the bounds of an integer range.
:: 5) Forgetting to properly initialize a variable.

Constraint errors are the largest difference in the FEEL of programming
Ada versus other languages, and all programmers experience them, in part
because of compiler/runtime/system problems, and in part because the
programmers are being caught inserting bugs into their programs. Some
of us believe that programmer insertion is the main source of bugs, and
therefore, Ada's ability to catch them is a significant advantage. Some
additional common causes of constraint errors are the following:

6) running out of memory at run-time   
7) not explicitly sliding an array (occurs much less in Ada 95)
8) dereferencing a pointer that is not memory mapped to real memory
9) dereferencing a pointer to non-existent virtual memory
10) taking the square root of -1
11) dividing by zero
12) taking the arctangent of (0, 0)
13) taking the logarithm of a negative real number
14) giving an invalid code to the floating point unit
15) moving a small array or string into a big array or string
16) moving a big array or string into a small array or string
17) using a subtype or type that has no element past the beginning or end
18) proceeding in a loop, going one item past the end of the subtype
19) invoking a run-time routine that fails
20) invoking an operating system call that fails
21) executing the Ada statement: RAISE CONSTRAINT_ERROR

and many others





  reply	other threads:[~1996-10-07  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-06  0:00 constraint-errors Paul O Svelmoe
1996-10-06  0:00 ` constraint-errors Michael Feldman
1996-10-06  0:00   ` constraint-errors Robert Dewar
1996-10-07  0:00 ` constraint-errors Tucker Taft
1996-10-07  0:00   ` Michael F Brenner [this message]
1996-10-07  0:00     ` constraint-errors Larry Kilgallen
1996-10-10  0:00     ` constraint-errors Norman H. Cohen
1996-10-11  0:00       ` constraint-errors Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox