Daniel Wengelin wrote:
> Please, could anyone see the probably obvious
> reason why this should terminate with Program_Error.
> It's basically "from the book" but I got some odd results.
> It compiles without any warnings, see below...
I added a couple of print outs to the end of your program (see "+"
lines below), and then compiled and ran it without problems (using our
AdaMagic with-C-as-intermediate compiler). The output
looked like this:
A_Car = (pelle,abc123)
Another_Car = (putte,gef789)
which seems correct.
Have you tried running it with a debugger? Presumably
that would tell you where the Program_Error is raised.
> with Ada.Strings.Unbounded;use Ada.Strings.Unbounded;
> with E1.Car;
+ with Ada.Text_IO;
> procedure E1.Main is
> A_Car, Another_Car : E1.Car.Object;
> A_Car := (To_Unbounded_String("putte"),
> Another_Car := (To_Unbounded_String("pelle"),
> E1.CAR.Swap (A_Car ,Another_Car);
+ Ada.Text_IO.Put_Line("A_Car = (" &
+ To_String(A_Car.Name) & ',' &
+ To_String(A_Car.Registration) & ')');
+ Ada.Text_IO.Put_Line("Another_Car = (" &
+ To_String(Another_Car.Name) & ',' &
+ To_String(Another_Car.Registration) & ')');
> end E1.Main;
-Tucker Taft [log in to unmask] http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.) Burlington, MA USA