[Interest] Three-file modules vs. moc

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Thu Aug 27 21:57:44 CEST 2020


Il 27/08/20 20:46, Bernhard Lindner ha scritto:
>> This is recommended anyway, regardless of your problem. Always #include the
>> module output for your headers in your corresponding .cpp files.
> Can you explain that general recommendation? It seems to me that such includes are only
> useful in special cases like mine and like .cpp files containing moc relevant code.

Including moc from the C++ code reduces compilation times (one "slightly 
larger" file to compile, not two) and enables the compiler to optimize 
more aggressively without resorting to LTO. As such it's always useful 
to do.

HTH,

-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200827/20808d3a/attachment.bin>


More information about the Interest mailing list