[Qt-interest] Replace Qt Allocator
Thiago Macieira
thiago at kde.org
Mon Sep 21 12:53:56 CEST 2009
Em Segunda-feira 21 Setembro 2009, às 08:51:13, você escreveu:
> But there's one thing I agree on. When a class does new an object (or
> call malloc), you should make sure that when this code is in the
> header file, the corresponding delete must go in the header file, too.
> And when the new is in the implementation-fiel, the delete must be in
> the implementation-file, too. That way even half-assed techniques like
> #define'ing malloc should work reasonably well.
That doesn't really work. It may not be possible in all cases.
That's the point of the One Definition Rule: ::operator new() should be the
same for everyone.
Note that some _platforms_ break the ODR, notably Windows, but also to some
extent Mac. On Linux and other ELF platforms it's very easy to add ::operator
new() to your application code and then all libraries will be using it.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4
http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090921/d7948d39/attachment.bin
More information about the Qt-interest-old
mailing list