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,5e54ec0ce937978 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!p77g2000hsh.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: String literals and wide_string literals - how? Date: 20 Apr 2007 07:33:29 -0700 Organization: http://groups.google.com Message-ID: <1177079608.910067.282070@p77g2000hsh.googlegroups.com> References: <1177063665.093083.241580@e65g2000hsc.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1177079609 21567 127.0.0.1 (20 Apr 2007 14:33:29 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 20 Apr 2007 14:33:29 +0000 (UTC) In-Reply-To: <1177063665.093083.241580@e65g2000hsc.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: p77g2000hsh.googlegroups.com; posting-host=66.126.103.122; posting-account=cw1zeQwAAABOY2vF_g6V_9cdsyY_wV9w Xref: g2news1.google.com comp.lang.ada:15153 Date: 2007-04-20T07:33:29-07:00 List-Id: On Apr 20, 3:07 am, Gerd wrote: > Hi all, > > if I have a string, then I can write a literal simply by writing > "abcd". But if I want write a wide_string literal, how do it? Same way. A string literal in quotes can be interpreted as a String, a Wide_String, a Wide_Wide_String, or any user-defined string type, depending on context. > Assume I have two procedure of the form: > > procedure do_anything (s : string); > > procedure do_anything (w : wide_string); > > then > > do_anything ("abcd"); > > would call the first one. No, it wouldn't. It would be illegal; since a string literal can be interpreted as a String or a Wide_String depending on context, the above is ambiguous because the compiler can't figure out which do_anything you want. You can use do_anything (String' ("abcd")); do_anything (Wide_String' ("abcd")); to tell the compiler which one you want to call. Or, since the two procedures have parameters of different names: do_anything (S => "abcd"); -- calls the first one do_anything (W => "abcd"); -- calls the second one > What would one write to call the second > one? > > Is there something like the L"xxx" in C? Thank God, no. -- Adam