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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,97439a4c062cf25d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII X-Received: by 10.66.221.42 with SMTP id qb10mr4875963pac.37.1368583464948; Tue, 14 May 2013 19:04:24 -0700 (PDT) Path: bp1ni2317pbd.1!nntp.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!newsflash.concordia.ca!News.Dal.Ca!news.litech.org!news.stack.nl!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: User defined type conversion Date: Thu, 09 May 2013 11:24:54 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: Mime-Version: 1.0 Injection-Date: Thu, 9 May 2013 18:21:18 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="656ea2f23126f57fb36504d2d15a002c"; logging-data="24572"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QMQ8K/fcx/45+a1ibk8rjhcn7Tbm8rs8=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: Cancel-Lock: sha1:8xgfeTuykqNnXs95t5LRnTpwV+8= X-Received-Bytes: 3042 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Date: 2013-05-09T11:24:54-07:00 List-Id: On 05/09/2013 07:07 AM, Vin�cius Franchini wrote: > > type AB is tagged > record > A : Unsigned_16; > B : Unsigned_16; > end record; > > type abcde is tagged > record > a: Unsigned_8; > b: Unsigned_8; > c: Unsigned_8; > d: Unsigned_8; > end record; > > X : AB; > Y : abcd; > > X := Y; The type of Y (Abcd) is undefined, so it's impossible to tell what you're trying to do. Also, types Unsigned_16 and Unsigned_8 are undefined. Even if we presume that you meant Y to be of type Abcde, and the Unsigned_* types to be those in package Interfaces, it's still unclear what you're trying to do. Which parts of Y do you expect to be combined into which parts of X, and in what way? Since you haven't specified this, other responses you've received that presume that certain parts of Y are specific bytes of parts of X may not be correct. Are you striving, as a good software engineer, to accomplish your goal in a portable way? Bear in mind that some platforms are big endian and others little endian, some byte addressable and others not. Since these are tagged records (why?), bear in mind that they contain a tag field, and the language does not specify where that field is located in objects of the type, nor where the other fields are located. All these factors make the solution using similar untagged records with representation clauses and Unchecked_Conversion non-portable. When you answer these questions, we can suggest ways to accomplish the task. -- Jeff Carter "There's no messiah here. There's a mess all right, but no messiah." Monty Python's Life of Brian 84