[Libreoffice] message construction bloat ...

Marc-André Laverdière marcandre.laverdiere at gmail.com
Thu Nov 24 13:49:32 PST 2011


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 at 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 at suse.cz

_______________________________________________
LibreOffice mailing list
LibreOffice at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20111124/36a4a950/attachment-0001.htm>


More information about the LibreOffice mailing list