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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!reality.xs3.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: GNAT.Serial_Communication and Streams Date: Mon, 23 Nov 2015 19:29:06 -0600 Organization: JSA Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1448328547 11888 24.196.82.226 (24 Nov 2015 01:29:07 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 24 Nov 2015 01:29:07 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:28515 Date: 2015-11-23T19:29:06-06:00 List-Id: "Jeffrey R. Carter" wrote in message news:n2tddf$eue$1@dont-email.me... ... > What about > > procedure Send (Cmd : in String) is > Local : constant String := Cmd & Ada.Characters.Latin_1.LF; > Output : constant Ada.Streams.Stream_Element_Array (1 .. Local'Length); > pragma Import (Ada, Output); > for Output'Address use Local'Address; > begin -- Send > GNAT.Serial_Communication.Write (P, Output)? > end Send; > > ? Probably works on GNAT, but it's not portable Ada code. For one thing, it assumes that Implementation Advice 13.3(14) is followed (Janus/Ada does not follow that advice - after all, it is just advice, not a requirement). It also assumes that Local is not optimized at all (there is advice that Output not be optimized, but that doesn't apply to Local, and like all advice, it can be ignored). Might not matter in this case (which is clearly GNAT-specific), but generally this is a pattern to avoid. Randy.