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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,413069df09dfed26 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Converting References: <1104260481.548435.238280@f14g2000cwb.googlegroups.com> In-Reply-To: <1104260481.548435.238280@f14g2000cwb.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 29 Dec 2004 04:43:15 GMT NNTP-Posting-Host: 4.240.189.163 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1104295395 4.240.189.163 (Tue, 28 Dec 2004 20:43:15 PST) NNTP-Posting-Date: Tue, 28 Dec 2004 20:43:15 PST Xref: g2news1.google.com comp.lang.ada:7278 Date: 2004-12-29T04:43:15+00:00 List-Id: 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