comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Converting
Date: Wed, 29 Dec 2004 04:43:15 GMT
Date: 2004-12-29T04:43:15+00:00	[thread overview]
Message-ID: <DBqAd.11667$RH4.295@newsread1.news.pas.earthlink.net> (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;

A string literal is a special form of an array aggregate. There need 
never be an explicit conversion from a literal to the type; the type of 
the literal must be determined from context, just as for any array 
aggregate.

In your example, there is only one string type: the type Standard.String.

C  : constant Standard.String := "This is a string literal";
V1 : A_Type.String := C;
V2 : B_Type_String := V1;

-- 
Jeff Carter
"Beyond 100,000 lines of code you
should probably be coding in Ada."
P. J. Plauger
26



  parent reply	other threads:[~2004-12-29  4:43 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 ` Converting Martin Dowie
2004-12-28 22:52 ` Converting Nick Roberts
2004-12-29  4:43 ` Jeffrey Carter [this message]
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