comp.lang.ada
 help / color / mirror / Atom feed
From: Luke A. Guest <laguest@archeia.com>
Subject: Re: Header-only Ada libraries...
Date: Thu, 31 May 2018 13:55:15 +0100
Date: 2018-05-31T13:55:15+01:00	[thread overview]
Message-ID: <1934663080.549464051.156486.laguest-archeia.com@nntp.aioe.org> (raw)
In-Reply-To: f4c08671-3bbb-44cc-8ec1-2eb615c6b076@googlegroups.com


> 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.


  parent reply	other threads:[~2018-05-31 12:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 11:14 Header-only Ada libraries Alejandro R. Mosteo
2018-05-31 12:18 ` joakimds
2018-05-31 12:38   ` Egil H H
2018-05-31 13:58     ` joakimds
2018-05-31 12:55   ` Luke A. Guest [this message]
2018-05-31 13:34   ` Jeffrey R. Carter
2018-05-31 13:35 ` Jeffrey R. Carter
2018-05-31 21:04   ` Robert A Duff
2018-05-31 22:53     ` Randy Brukardt
2018-06-01  9:15     ` Jeffrey R. Carter
2018-06-01 10:00       ` Dmitry A. Kazakov
2018-06-05 12:31   ` Alejandro R. Mosteo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox