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

Thiago Macieira thiago.macieira at intel.com
Sun Mar 8 18:47:15 CET 2015


On Sunday 08 March 2015 14:28:55 Constantin Makshin wrote:
> 1) less code and data -> smaller executable;

That might not be true.

Assuming you replaced a private slot declaration with just a member function 
connection, there should be only minimal benefit in code size (only the moc 
tables and moc-generated code).

If you're replacing with lambdas, then it's possible to increase code size.

> 2) less code -> faster compilation;

Again, not necessarily true. You're replacing a macro that expands to nothing 
and a few function declarations with template-heavy code. So there's a 
marginal improvement in parsing the header for N builds, but an increase in 
time for one file.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list