[Development] Unnecessary ambiguity in Qt documentation about reentrancy and safety of const methods.
Thiago Macieira
thiago.macieira at intel.com
Sun Jul 19 01:18:28 CEST 2026
On Saturday, 18 July 2026 14:48:34 Pacific Daylight Time Giuseppe D'Angelo via
Development wrote:
> For QMap I introduced QESDPV2 precisely because I wanted deep constness.
> Neither QESDP nor the standard library smart pointers propagate, and
> those are landmines. We should likely also introduce a private
> propagate_const if someone really needs a raw pointer for whatever reason.
It's interesting that the d_func() from Q_DECLARE_PRIVATE does propagate
constness, because the d_func() const returns a const Private *.
Though it's still possible to accidentally violate it in a new indirection, if
the Private contains another pointer. The pointer is const, but the pointee
isn't.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Principal Engineer - Intel DCG - Platform & Sys. Eng.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5176 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20260718/e2e84ebf/attachment.bin>
More information about the Development
mailing list