[Development] Suggested addition to wiki.qt.io/Coding_Conventions

Thiago Macieira thiago.macieira at intel.com
Thu May 14 01:48:36 CEST 2015


On Thursday 14 May 2015 02:15:54 Marc Mutz wrote:
> On Wednesday 13 May 2015 23:36:29 Olivier Goffart wrote:
> > On Thursday 14. May 2015 05:57:54 Thiago Macieira wrote:
> > > You cannot compare the addresses [of inline methods]
> > > This is intentional and if you rely on that, your code is flawed by
> > > design.
> > 
> > Why not?
> > The C++ standards does not forbid it. It defines that it works. I see no
> > exceptions for inline functions in ยง5.10 (C++14).
> > 
> > We rely on this when connecting using function pointers to inline slot
> > with
> > Qt::UniqueConnection
> > 
> > So if the two connect statements are in different library that might
> > fails...
> 
> The standard doesn't talk about DLLs and SOs. Semantics of those constructs
> is supplied by the platform ABI, not std-C++.

Right.

My point is that we made that choice when we decided to use -fvisibility-
inlines-hidden. Try not to take the addresses of inlines and, if you do, don't 
compare them.

UniqueConnection does not work for functors anyway, so people should get in 
the habit of assuming it doesn't work for anything else.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list