Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ed Smith-Rowland <3dw4rd@verizon.net> |
|---|---|
| Newsgroups | comp.std.c++ |
| Subject | Re: user-defined literals and macros |
| Date | 2011-10-31 11:11 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <aefd1549-e46d-49a1-8198-421fe5844fe6@x20g2000vbl.googlegroups.com> (permalink) |
| References | <21848168.4112.1319981727733.JavaMail.geo-discussion-forums@yqbl36> |
On Oct 30, 2:09 pm, cryptooctopl...@gmail.com wrote:
> Consider:
> % cat liter.cpp
> #define BAR "foo"
> int main()
> {
> char *foobar("foo/"BAR);
>
> }
>
> % g++ liter.cpp -std=gnu++0x
> liter.cpp: In function ‘int main()’:
> liter.cpp:4:16: error: unable to find user-defined string literal operator ‘operator"" BAR’
>
> Is this the expected behavior?
>
> --
> [ comp.std.c++ is moderated. To submit articles, try posting with your ]
> [ newsreader. If that fails, use mailto:std-cpp-sub...@vandevoorde.com ]
> [ --- Please see the FAQ before posting. --- ]
> [ FAQ:http://www.comeaucomputing.com/csc/faq.html ]
Yes, this is now the expected behavior. "foo/"BAR is now considered a
single lexical token - a user-defined string literal. The compiler
will look for 'operator"" BAR(const char*, std::size_t)' and if found
insert a call at the location of the literal 'operator"" BAR("foo/",
5)'.
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Next in thread | Find similar
user-defined literals and macros cryptooctoploid@gmail.com - 2011-10-30 11:09 -0700
Re: user-defined literals and macros Johannes Schaub <schaub.johannes@googlemail.com> - 2011-10-31 11:10 -0700
Re: user-defined literals and macros David Krauss <potswa@gmail.com> - 2011-10-31 11:11 -0700
Re: user-defined literals and macros Ed Smith-Rowland <3dw4rd@verizon.net> - 2011-10-31 11:11 -0700
Re: user-defined literals and macros Ed Smith-Rowland<3dw4rd@verizon.net> - 2011-11-01 11:14 -0700
Re: user-defined literals and macros Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-10-31 11:12 -0700
csiph-web