[Qt-interest] A small request !
Mihail Naydenov
mlists at ymail.com
Wed Sep 30 16:20:38 CEST 2009
----- Original Message ----
> From: Ian Thomson <Ian.Thomson at iongeo.com>
> To: qt-interest at trolltech.com
> Sent: Wednesday, September 30, 2009 4:12:51 PM
> Subject: Re: [Qt-interest] A small request !
>
> Hi,
>
> >
> > No, no profiling, just the "the right thing" feel.
> >
> > You should agree:
> >
> > setX(x() + something);
> >
> > instead of:
> >
> > xp += something;
> >
> > is both uglier, and (almost certainly) slower.
> >
>
> Both setX(int) and x() are declared inlinable and will certainly be
> inlined by the compiler. That means there is no speed difference at all.
> You can alternatively use the reference call:
>
> rx() += something;
Now, this was helpful! I remember noticing these in the header, but for some reason forgot them in the actual code.
Thank You for pointing that out!
I guess the arguments now are just academic.
MihailNaydenov
>
> This will also incur no function call penalty and almost matches the
> syntax you desire. I don't really see either of them as being ugly, in
> fact both methods are very clear.
>
> Cheers,
> Ian.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list