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: 103376,6b93224dbe2bb55b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.88.41 with SMTP id bd9mr2125825pab.38.1354537545107; Mon, 03 Dec 2012 04:25:45 -0800 (PST) Path: s9ni23680pbb.0!nntp.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Return unconstrained types in ZFP References: <3254b304-ed8b-4601-8a3c-ab3df74d84ad@googlegroups.com> Date: Mon, 03 Dec 2012 07:25:41 -0500 Message-ID: <85boebuxtm.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (windows-nt) Cancel-Lock: sha1:FqMLNyoEPfWK39UdUcwHlF3xpmI= MIME-Version: 1.0 X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: ee58950bc9a48e029e66117956 X-Received-Bytes: 1625 Content-Type: text/plain Date: 2012-12-03T07:25:41-05:00 List-Id: "Rego, P." writes: > I am trying to implement, for an ATmega2560 (Arduino Mega) micro-controller using ZFP in GNAT-AVR, an USART unconstrained Get string like > function Get (Port : USART_Port_Type; Size : Unsigned_8) return > String_U8; Is "Size" a maximum here, or is the result expected to be exactly Size bytes long? Another alternative is to use a procedure: procedure Get (Port : in USART_Port_Type; Data : out String_U8; Data_Last : out Unsigned_8); Then the user must allocate space for Data: declare Data : String_U8 (1 .. Size); Data_Last : Unsigned_8; begin Get (Port, Data, Data_Last); ... use Data end; This way, you don't need to implement the runtime code. It is more of a burden for the user, but that's the point of ZFP; it's easier to implement, harder to use. -- -- Stephe