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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Luke A. Guest Newsgroups: comp.lang.ada Subject: Re: Header-only Ada libraries... Date: Thu, 31 May 2018 13:55:15 +0100 Organization: Aioe.org NNTP Server Message-ID: <1934663080.549464051.156486.laguest-archeia.com@nntp.aioe.org> References: NNTP-Posting-Host: 7g1xAi69fD1aacr2pkK7Yw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: NewsTap/5.3.1 (iPhone/iPod Touch) Cancel-Lock: sha1:tzOFEprxep4bLWvaozSovHAO/L4= X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:52807 Date: 2018-05-31T13:55:15+01:00 List-Id: > type C_String is new String with > Dynamic_Predicate => C_String'Length > 0 > and then C_String (C_String'Last) = Nul; > > For convience I added the following conversion routines between standard > String types and C_String types in the Posix package: > > > function "-" (Text : C_String) return String; > -- Removes the last 'Nul' character and returns a normal String. > > function "+" (Text : String) return C_String; > -- Appends a 'Nul' character to a standard String and returns a C_String. > > Not sure how well known this trick is so just mentioning it :) > Ok, that’s pretty cool. Not seen that before.