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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,79db4ff72bff9422 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-25 05:43:41 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: sk Newsgroups: comp.lang.ada Subject: Re: How to convert record? Date: Thu, 25 Oct 2001 07:38:53 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <80d2e34.0110210156.7918cd3d@posting.google.com> <3bd402f9.8783319@news.demon.co.uk> <80d2e34.0110250340.155ae0b7@posting.google.com> 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 1004013820 75815 137.194.161.2 (25 Oct 2001 12:43:40 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 25 Oct 2001 12:43:40 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19-4.3mdk i686) X-Accept-Language: en Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.6 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:15179 Date: 2001-10-25T07:38:53-05:00 --Anyhow I tried to do Unchecked_Conversion and gnat gave me error --message: -- --"unchecked conversion to unconstrained array not allowed". -- --What should I do? Constrain it o o | \_/ declare type X_Type is record a : Natural; b : Boolean; end record; Record_Character_Size : Natural := ( X_Type'Size / Character'Size ); type Buffer_Type is new String; -- Unconstrained Buffer_Type subtype String_For_Record is Buffer_Type (1 .. Record_Character_Size); function To_Buffer is new Ada.Unchecked_Conversion ( Source => X_Type, String_For_Record ); X : X_Type; begin Do_Something (To_Buffer(X)); end;