singleton::exists() addition for K_GLOBAL_STATIC
Thiago Macieira
thiago at kde.org
Mon May 5 16:06:57 BST 2008
On Monday 05 May 2008 15:15:56 David Faure wrote:
> > I'd go as far now as marking all of those extra methods
> > __attribute__((always_inline)) to make sure gcc never generates them if
> > they're not used.
>
> Is this really necessary with template classes? I thought this happened
> automatically.
True, for template classes, unless you're on Windows and you exporting the
class.
But this isn't a template class (the KDE 3 equivalent was). This is an
anonymous struct:
# define K_GLOBAL_STATIC_STRUCT_NAME(NAME)
static struct K_GLOBAL_STATIC_STRUCT_NAME(NAME) \
[...]
} NAME;
It can't be a template class because it might still generate global symbols,
especially if you're not building with visibility support. This way, we
defined an anonymous class on a file-static variable. There are no exports.
(Except on one broken compiler that doesn't like anonymous structs)
> If not, then it sounds like something for kdemacros.h.cmake
> (KDE_ALWAYS_INLINE?). But it does sound like something people will abuse
> instead of letting the compiler choose :)
Yeah.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080505/3959c702/attachment.sig>
More information about the kde-core-devel
mailing list