comp.lang.ada
 help / color / mirror / Atom feed
* type casting tagged types in the wrong direction
@ 1996-03-27  0:00 James A. Squire
  1996-03-28  0:00 ` Norman H. Cohen
  1996-03-28  0:00 ` Tucker Taft
  0 siblings, 2 replies; 10+ messages in thread
From: James A. Squire @ 1996-03-27  0:00 UTC (permalink / raw)


I have a question:

Say I have something like:

type A is tagged
  record
    X : ABC;
    Y : DEF;
  end record;

type B is new A with
  record
    W : GHI;
  end record;

type C is new B with
  record
    Z : JKL;
  end record;


OK.  Now, let's say that I forgot which type extends off of which, and I
write a statement like this:

  Jim  : C;
  Jane : B;
  Save : JKL;

begin
  ...
  Jim := C (Jane);
  Save := Jim.Z;
  ...
end;

GNAT 3.03 compiles this statement.  Is that really right?  Is Jim.Z
defined?
According to the LRM 4.6, the above is called a "view conversion".  This
raises the question, how do you take a type C view of a type B entity
when type C looks for additional information?

Should a validated Ada95 compiler flag this usage?  I realize that GNAT
is not validated.

I would appreciate any expert or otherwise opinions that any of you have
to offer.
Thank you.
--
James Squire
MDA Avionics Tools & Processes
ja_squire@csehp3.mdc.com
"one of these days I'm going to better myself by going to Knight school"




^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <md5:5AA0EAFF641BB9F461162E7F13E1101F>]

end of thread, other threads:[~1996-03-31  0:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-27  0:00 type casting tagged types in the wrong direction James A. Squire
1996-03-28  0:00 ` Norman H. Cohen
1996-03-28  0:00   ` Robert Dewar
1996-03-28  0:00 ` Tucker Taft
1996-03-28  0:00   ` Robert Dewar
1996-03-30  0:00     ` Fergus Henderson
1996-03-31  0:00       ` Robert Dewar
1996-03-29  0:00   ` type casting tagged types in the wrong Scott Moody
     [not found] <md5:5AA0EAFF641BB9F461162E7F13E1101F>
1996-03-29  0:00 ` type casting tagged types in the wrong direction James A. Squire
1996-03-29  0:00   ` Robert Dewar

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