Subject: Re: [boost] [log] Status (was: Is there any interest in a Group of library like to Application System!)
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-01-05 04:53:03


On Thursday, January 05, 2012 10:43:10 Roman Perepelitsa wrote:
> 2012/1/5 Arash Partow <arash_at_[hidden]>
>
> > On 4/01/2012 10:31 PM, Andrey Semashev wrote:
> >> There are many other things to be done but they are not showstoppers
> >> for
> >> the
> >> release.
> >
> > Out of curiosity, have you considered at some point adding support for
> > the new C++11 user-defined literals? I believe there would be a huge
> > efficiency advantage in having the length of the literal at compile
> > time, rather than having to determine it at run-time.
>
> I don't know about other compilers but gcc can execute strlen in compile
> time if passed a literal as input.

Yes, but in real life I have only seen examples of such optimization when the
code calls strlen inside a function and this function gets inlined. Then the
compiler may be smart enough to see that strlen is actually called on a
literal and replace it with a constant. I think I also saw this with some
recent MSVC but I'm not sure. All in all, this optimization is at compiler's
mercy.