[Development] changing Q_GADGET

Julien Blanc julien.blanc at nmc-company.com
Fri Nov 28 16:57:11 CET 2014


On 28/11/2014 16:13, Gunnar Roth wrote:
>   Hi Simon
>   
>> 2) On paper it breaks binary compatibility with MSVC, in the unlikely event
>> that somebody
>> a) produces a DLL and cares about binary compatibility
>   
> Why do you think that is unlikely?
>
> Actually right now i depend on that. I get stuff build against qt 5.2.1 dlls and use that stuff and my stuff using at 5.3.2 by exchanginng thge qt dlls with my 5.3.2 dlls , so  i rely on binary compatibility.

What’s unlikely is that you get all a), b) and c) :

     a) produces a DLL and cares about binary compatibility
     b) exposes bare structures
     c) relies on Q_GADGET turning access permission levels to private


I guess most people don’t do c). Actually, any sane person would not 
like a macro to change the private / public context as a side effect, 
and the fact that Q_OBJECT does it (because it just can’t do otherwise) 
should more be considered a bug / lack in C++ than anything else, 
certainly not a feature to rely on.

However, i may be missing something but Q_GADGET needs also to 
explicitely change the private / public context to introduce public 
members. So, the initial proposal to not changing that context would 
require Q_GADGET to be in a public context. I guess that one would break 
a lot of code.

Regards,

Julien



More information about the Development mailing list