[Qt-interest] A small request !
Ian Thomson
Ian.Thomson at iongeo.com
Wed Sep 30 15:12:51 CEST 2009
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;
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.
More information about the Qt-interest-old
mailing list