[Development] MSVC not inlining QRect inline functions (anymore?)

Marc Mutz marc.mutz at qt.io
Mon Jun 8 10:01:56 CEST 2026


On 08.06.26 00:02, Thiago Macieira wrote:

On Sunday, 7 June 2026 08:48:33 Pacific Daylight Time Christian Ehrlicher via
Development wrote:


I recently found out that none of the QRect inline functions are inlined
by msvc no matter what compiler options I pass. Tested with recent cl
(19.51.36244) but also saw this with older msvc2022 compilers.
Is this known and should/can we do something against this?


Get a better compiler.

MSVC is well-known for *not* inlining functions that are dllimported, if they
are anything except the most trivial.

Christian said that QRectF doesn't have the problem, and fingered QCheckedInt as the potential culprit.

I think you may both be right. QRectF is also wholesale-exported, but the QCheckedInt change pushed QRect into "anything but most trivial" mode.

Aaaand another entry into the ever-growing list of "never wholesale-export a non-polymorphic rule" failures (https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Value_Classes Item 6).

Thanks,
Marc

PS: from a recent Claude Opus conversation:

The non-export rule for non-polymorphic classes has essentially no legitimate exception — the only reason to whole-class export one is laziness, and it strictly costs you. The closest thing is a non-polymorphic class you're exporting every member of anyway, where the wholesale macro is just shorthand; even then it silently re-emits inlines and invites C4251, so prefer the explicit member exports.


--

Marc Mutz <marc.mutz at qt.io><mailto:marc.mutz at qt.io> (he/his)
Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io<http://www.qt.io>

Geschäftsführer: Mika Pälsi, Juha Varelius, Juha Puputti
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B

Public
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20260608/9c039198/attachment.htm>


More information about the Development mailing list