comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Dowie <martin.dowie@btopenworld.com>
Subject: Re: Converting
Date: Tue, 28 Dec 2004 21:12:33 +0000 (UTC)
Date: 2004-12-28T21:12:33+00:00	[thread overview]
Message-ID: <cqsi81$91o$1@titan.btinternet.com> (raw)
In-Reply-To: <1104260481.548435.238280@f14g2000cwb.googlegroups.com>

conradwt@runbox.com wrote:
> Hi, I was wondering, could someone tell me the best way to convert s
> string literal to a subtype.  For example,
> 
> subtype A_Type.String is Standard.String;
> subtype B_Type_String is A_Type.String;
> 
> Now, I would like to convert a string literal to B_Type_String.  BTW,
> the method that I'm calling requires the type B_Type_String.  Last but
> least, I using the most recent version of gnat to do the compile.  If
> anyone has any ideas as to the best way to resolve this issue and
> reducing the number of code changes, I would be most appreciative.
> Thanks in advance,

Subtypes don't create new types, so if you have a string literal it is 
most likely to be of type Standard.String anyway (or it could be a 
Wide_String).

I only use subtypes if I'm also adding a constraint to the type (i.e. 
reducing the range of valid values it can take).



  reply	other threads:[~2004-12-28 21:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-28 19:01 Converting conradwt
2004-12-28 21:12 ` Martin Dowie [this message]
2004-12-28 22:52 ` Converting Nick Roberts
2004-12-29  4:43 ` Converting Jeffrey Carter
2004-12-29  5:06 ` Converting Lady Chatterly
2004-12-29 19:07 ` Converting Martin Krischik
replies disabled

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