From: Adam Beneschan <adam@irvine.com>
Subject: Re: String literals and wide_string literals - how?
Date: 20 Apr 2007 07:33:29 -0700
Date: 2007-04-20T07:33:29-07:00 [thread overview]
Message-ID: <1177079608.910067.282070@p77g2000hsh.googlegroups.com> (raw)
In-Reply-To: <1177063665.093083.241580@e65g2000hsc.googlegroups.com>
On Apr 20, 3:07 am, Gerd <Gerd...@t-online.de> 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
next prev parent reply other threads:[~2007-04-20 14:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-20 10:07 String literals and wide_string literals - how? Gerd
2007-04-20 14:33 ` Adam Beneschan [this message]
2007-04-20 14:55 ` Robert A Duff
2007-04-20 19:16 ` Randy Brukardt
2007-04-20 20:01 ` Adam Beneschan
2007-04-20 20:41 ` Dmitry A. Kazakov
2007-04-20 20:02 ` Robert A Duff
2007-05-21 2:33 ` David Thompson
2007-05-22 22:32 ` Randy Brukardt
2007-05-23 18:42 ` Jeffrey R. Carter
[not found] ` <f324h5$fna$1@f04n12.cac.psu.edu>
2007-05-24 21:15 ` Jeffrey R. Carter
2007-05-23 2:27 ` Keith Thompson
2007-07-01 1:00 ` David Thompson
2007-05-23 12:28 ` brian.b.mcguinness
2007-04-20 20:48 ` Dmitry A. Kazakov
2007-04-20 22:09 ` Jeffrey R. Carter
2007-04-21 9:41 ` Simon Wright
2007-04-22 0:35 ` Jeffrey R. Carter
2007-04-22 9:45 ` Simon Wright
2007-04-22 20:15 ` Jeffrey R. Carter
2007-04-22 21:18 ` Simon Wright
2007-04-23 1:44 ` Jeffrey R. Carter
2007-04-22 1:00 ` Robert A Duff
2007-04-20 14:58 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox