From: Victor Porton <porton@narod.ru>
Subject: Ada.Strings.Unbounded vs Ada.Containers.Indefinite_Holders
Date: Thu, 21 Sep 2017 21:14:25 +0300
Date: 2017-09-21T21:14:25+03:00 [thread overview]
Message-ID: <oq0vi0$1i26$1@gioia.aioe.org> (raw)
I am writing an interface to a C library. Some C functions accept either a C
string pointer or NULL.
I need some way to define an Ada object which could hold values equivalent
to C strings with possible NULL.
I consider two approaches:
1. Ada.Strings.Unbounded (remind that it can be Null_Unbounded_String which
is equivalent to NULL C string).
2. Ada.Containers.Indefinite_Holders holding a String.
The first way seems more natural, as a more specialized package is used.
The second way may have the advantage that there is Is_Empty function while
for unbounded strings I would need to compare with Null_Unbounded_String
using "=" operator. This may be a little slower. Or does it matter with
modern compilers?
Hm well, do I understand Null_Unbounded_String correctly? Is
Null_Unbounded_String really "no string"? or is it just empty string ("")?
RM2012 should be made more clear on this topic!
--
Victor Porton - http://portonvictor.org
next reply other threads:[~2017-09-21 18:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 18:14 Victor Porton [this message]
2017-09-21 21:30 ` Ada.Strings.Unbounded vs Ada.Containers.Indefinite_Holders AdaMagica
2017-09-22 12:16 ` Victor Porton
2017-09-22 19:25 ` Simon Wright
2017-09-22 22:15 ` Victor Porton
2017-09-23 8:09 ` Dmitry A. Kazakov
2017-09-23 9:16 ` Jeffrey R. Carter
2017-10-03 0:15 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox