[Development] Extending Visual Studio's display of Qt classes

shane.kearns at accenture.com shane.kearns at accenture.com
Mon Sep 17 14:14:34 CEST 2012


> -----Original Message-----
> From: development-bounces+shane.kearns=accenture.com at qt-project.org
> [mailto:development-bounces+shane.kearns=accenture.com at qt-project.org]
> On Behalf Of Tom Isaacson
> Sent: 16 September 2012 11:08
> To: development at qt-project.org
> Subject: [Development] Extending Visual Studio's display of Qt classes
>
> I understand why the Pimpl Idiom is being used here, but I'm wondering
> if it's actually necessary. It's intended for when the source code of
> the implementation isn't available so internal variables and function
> names can be completely hidden. But in the case of Qt, where the source
> code is available and can even be used to build your own binaries, it
> seems excessive. It also means that useful displays of debugging data
> aren't really possible and you have to resort to what I've done below.
>
> Can I suggest that going forward the Pimpl Idiom is dropped and we go
> back to just using private member variables and functions to prevent
> them being called from outside the class? Or is there some alternative
> that would allow VS to see the layout it needs?

Hi Tom,

This is not the reason we use the idiom. It is used to ensure we can maintain
ABI compatibility between releases.

Changing the size of a c++ class is a binary incompatible change.
Code compiled into the application could be dependent on the size of the class.
So we could never add or remove variables even if they have private visibility.

When using this idiom, the public class contains only a pointer to the private class.
The private class can be freely changed between releases because it's explicitly not
part of the API.

The public class remains the same, just containing a pointer to the new private class.

Except for QString / QByteArray which store offsets rather than pointer, you should
be able to expand the d pointer in the MSVC debugger, as long as Qt was built with
debug symbols.

Subject to local law, communications with Accenture and its affiliates including telephone calls and emails (including content), may be monitored by our systems for the purposes of security and the assessment of internal compliance with Accenture policy.
______________________________________________________________________________________

www.accenture.com




More information about the Development mailing list