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 X-Google-Thread: 103376,2d56530d3025e324 X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: Program error from assignment?? Date: 1998/07/22 Message-ID: <6p556m$e4o$1@platane.wanadoo.fr>#1/1 X-Deja-AN: 373893578 Content-Transfer-Encoding: 8bit References: <6p3070$bvn$1@nnrp1.dejanews.com> <6p4skk$j73$1@nnrp1.dejanews.com> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Adalog Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-07-22T00:00:00+00:00 List-Id: dennison@telepath.com a �crit dans le message <6p4skk$j73$1@nnrp1.dejanews.com>... >In article <6p3070$bvn$1@nnrp1.dejanews.com>, > dennison@telepath.com wrote: >> OK. I give up. >> >> I have the following code: >. >. >. >> The problem is that I'm getting a Program_Error on the second assignment at >> runtime. What could cause that? > >OK. Since everyone seems to be completely speechless :-), here's what I've >found out so far: > >Program_Error can happen on this assignment when the accessability level of >the source pointer's object is deeper than that of the target object's type. >That's so I can't keep around a pointer to an object after it goes away. Fair >enough. > >So now this turns into an "accessability level" question. The object that is >pointed to is declared in the declaration section of the main routine. It >exists the entire program. I don't understand the exact rules on accessability >levels, but in my book I should *never* fail an accessability check with this >object. The access type is declared in a package spec. > OK, you almost got it right. Yes, it is a problem with dynamic accessibility level. Now remember, a type declared in a library package is at accessibility level 0, while an object declared in a library *procedure* (even the one used as the main program) is at accessibility level 1. Remember that the main program is a regular procedure in Ada. For example, a library package could declare tasks that would in turn call the main program as a regular procedure... -- ---------------------------------------------------------------------------- J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://perso.wanadoo.fr/adalog