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!news4.google.com!news.glorb.com!easynet-monga!easynet.net!zen.net.uk!demorgan.zen.co.uk!194.72.9.35.MISMATCH!news-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: Martin Dowie Newsgroups: comp.lang.ada Subject: Re: Converting Date: Tue, 28 Dec 2004 21:12:33 +0000 (UTC) Organization: BT Openworld Message-ID: References: <1104260481.548435.238280@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: host81-152-56-142.range81-152.btcentralplus.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: titan.btinternet.com 1104268353 9272 81.152.56.142 (28 Dec 2004 21:12:33 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Tue, 28 Dec 2004 21:12:33 +0000 (UTC) In-Reply-To: <1104260481.548435.238280@f14g2000cwb.googlegroups.com> X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) Xref: g2news1.google.com comp.lang.ada:7274 Date: 2004-12-28T21:12:33+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; > > 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).