Can we get the c++ equivalent of logback/slf4j? Avoiding string concat most
of the time is the better option.
Marc-André Laverdière
Sent from a mobile device, please excuse the brevity
On 23 Nov 2011 11:56, "Lubos Lunak" <l.lunak@suse.cz> wrote:
On Wednesday 23 of November 2011, Michael Meeks wrote:
On Wed, 2011-11-23 at 14:56 +0100, Lubos Lunak wrote:
And some of the arguments are rather weak as well, I can get you easy to
use and read, bett...
I haven't thought it out in detail, but the general idea is attached. It's
just a proof of concept, so there are some obvious problems, but I don't see
a flaw in the design. Since it's also just a single call, the in-place cost
is small and is moved to the bodies of the templates, which can be just in
one place, one per each combination of arguments (and the common instances
of
the template can be externed, so it really will be just one copy). The
template code is relatively small, so I don't expect noticeable impact on
compile time. Also, funnily enough, the generated code in the place of the
call is one instruction shorter, because unlike printf() it does not need
the
terminating NULL for the vararg :).
I expect it would be even possible to achieve such single in-place call
even
for the LOG( "P is " << p << " and b is " << b ) case, or even do this for
string+string operation, which would turn it into the even better-looking
LOG( "P is " + p + " and b is " b ) or LOG( "P is %1 and b is %2", p, b ),
whichever would suit one's fancy (as in, both would be possible at the same
time). It would require getting a bit more creative with argument and return
types for the operator overloads, but that'd be hidden behind the scenes.
--
Lubos Lunak
l.lunak@suse.cz
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
Context
- Re: [Libreoffice] message construction bloat ... (continued)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.