From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,932267eb02cfdff6 X-Google-Attributes: gid103376,public From: mfeldman@seas.gwu.edu (Michael Feldman) Subject: Re: raised Constraint_Error? Date: 1995/04/03 Message-ID: <3lpe27$2mv@felix.seas.gwu.edu>#1/1 X-Deja-AN: 100815560 references: organization: George Washington University newsgroups: comp.lang.ada Date: 1995-04-03T00:00:00+00:00 List-Id: In article , Jeff Winchester 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/ ------------------------------------------------------------------------