comp.lang.ada
 help / color / mirror / Atom feed
From: mfeldman@seas.gwu.edu (Michael Feldman)
Subject: Re: raised Constraint_Error?
Date: 1995/04/03
Date: 1995-04-03T00:00:00+00:00	[thread overview]
Message-ID: <3lpe27$2mv@felix.seas.gwu.edu> (raw)
In-Reply-To: Pine.SUN.3.91.950403111430.12054B-100000@babbage

In article <Pine.SUN.3.91.950403111430.12054B-100000@babbage>,
Jeff Winchester  <winchest@csee.usf.edu> wrote:
>Could anyone tell me why the following code would cause a constraint 
>error?  I've been pulling out hairs for a couple of days now and am 
>obviously overlooking something simple.  Thanks.
>
Hmmm. I think it's going a bit far to ask net readers to
dig in so deep into your code. You need to do this sort of
detective work yourself, especially in a course. OTOH:

Some hints:

Your compiler ought to have a debugger, or at least give you a stack
dump when the Constraint_Error is propagated. This should tell you
in just which line the exception was raised, and where it propagated.

Constraint_Error in linked-list processing is most often caused by the
list-traversal loop walking right off the end of the list - a kind
of off-by-one problem.  When you reach the end of the list, and then
try to dereference a null pointer, Ada raises Constraint_Error.

If all else fails, add a Put_Line or two with a message that displays
each time you go around the loop.

Aren't they teaching debugging techniques at USF?

Mike Feldman
------------------------------------------------------------------------
Michael B. Feldman -  chair, SIGAda Education Working Group
Professor, Dept. of Electrical Engineering and Computer Science
The George Washington University -  Washington, DC 20052 USA
202-994-5919 (voice) - 202-994-0227 (fax) - mfeldman@seas.gwu.edu (Internet)
------------------------------------------------------------------------
One, two, three ways an underdog: Ada fan, Mac fan, Old Liberal Democrat
------------------------------------------------------------------------
Ada on the WWW: http://lglwww.epfl.ch/Ada/ or http://info.acm.org/sigada/
------------------------------------------------------------------------




  reply	other threads:[~1995-04-03  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-04-03  0:00 raised Constraint_Error? Jeff Winchester
1995-04-03  0:00 ` Michael Feldman [this message]
1995-04-03  0:00   ` Jeff Winchester
1995-04-04  0:00 ` Kevin F. Quinn
replies disabled

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