[Development] QProperty and library coding guide
lars.knoll at qt.io
Fri Jul 17 11:36:20 CEST 2020
> On 17 Jul 2020, at 11:25, Giuseppe D'Angelo via Development <development at qt-project.org> wrote:
> Il 17/07/20 11:05, Lars Knoll ha scritto:
>>> No, we should just static_assert for [[no_unique_address]] being available on the platforms where we expect it. That is, anywhere but on certain MSVCs.
>> Some older embedded toolchains don’t have the flag neither.
>>> If we make it a configure feature, we open the door to BIC problems as we might accidentally turn it off in some builds.
>> We should simply add a static assert that the Qt and the applications build mode are compatible.
> But what would be the advantage of switching from the union to the attribute? Saving 1 byte per class?
Its probably 8 bytes you save because of alignment.
And it’s cleaner, because using the union trick, we do access several members of the union at the same time. It works on all compilers but I’m not 100% convinced it’s fully defined behavior according to C++, even if the members don’t have data.
And why wouldn’t we do it, if the compilers support it?
> 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
> Development mailing list
> Development at qt-project.org
More information about the Development