[Interest] Does removing 'private slots' from .h files have any advantages? Disadvantages?

Constantin Makshin cmakshin at gmail.com
Sun Mar 8 12:28:55 CET 2015


Both advantages and disadvantages will come from the fact that MOC won't
generate anything for methods in these sections.

Pros:
1) less code and data -> smaller executable;
2) less code -> faster compilation;
3) smaller "MOC table" -> faster lookups when connecting and/or
processing signals.

Cons:
1) no runtime information about signals and slots -> no way to
[semi]automagically make them available to non-C++ parts of the
application (scripts, etc.) or anything else that can't be "configured"
at compile-time.

I'd say the change is mostly cosmetic since the benefits are negligible
and the only disadvantage I can think of is not critical for some/most
applications.

On 03/08/2015 01:58 PM, Guido Seifert wrote:
> Hi,
> I am just curious. In one of my old projects I replaced all SIGNAL/SLOT connections with the newer function pointer api.
> In theory I now could remove all the 'public/protected/private slot' markers from my .h files. Now I am wondering, if this
> is only cosmetic, or does it have any advantages/disadvantages? Faster compile time? Smaller executables? 
> 
> Guido

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150308/8b80b077/attachment.sig>


More information about the Interest mailing list