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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e64088334cf5790e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-13 09:22:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Steven Deller" Newsgroups: comp.lang.ada Subject: RE: Exchanging objects between programs with different inheritance hierarchies Date: Wed, 13 Nov 2002 11:22:55 -0600 Organization: Smooth Sailing LLC Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1037208122 7737 137.194.161.2 (13 Nov 2002 17:22:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 13 Nov 2002 17:22:02 +0000 (UTC) Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 In-reply-to: <200211131218.NAA13957@bulgaria.otn.eurocopter.de> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Importance: Normal Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:30816 Date: 2002-11-13T11:22:55-06:00 > -----Original Message----- > From: comp.lang.ada-admin@ada.eu.org > [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of Grein, Christoph > You should have a look at the attribute 'External_Tag. ... Christoph, Thanks. As I thought about the problem last night without an RM handy, I wondered if one could rep spec the external tag. Lo and behold, one can!!! Just rep spec the derived types, use 'Class'Output/Input on the "prime" type and we are cooking :-). Don't even have to override the default type outputs as long as the same compiler is used on machines with the same endian-ness. Love that Ada. One other question. Suppose I have type Top is tagged ... -- our "prime" type type X type A_Top is access Top'Class ; -- Only allocated objects are used type A_X is access X ; Obj : A_Top ; X : A_X ; Obj := function_returning_A_top ; X := A_X ( Obj) ; -- This is allowed, right? Does the conversion of an A_Top class access type to a specific A_X access type have any code associated with it, besides a tag check? (That is, in general does an Ada compiler have to do anything except check the tag and copy the "pointer"?) A specific answer for GNAT would suffice. I'm guessing there is nothing except the tag check, since "all" was not used for defining the access types, but I feel a little like I'm tiptoeing through land mines here (I'd prefer tulips :-) ). Oh -- does C++ have anything similar for easy exchange of different class objects across a single stream (without knowing ahead of time which object is to be read)? If not, this is another big win for Ada :-). Regards, Steve