Keeping binary compatibility

Thiago Macieira thiago at kde.org
Tue Oct 5 15:37:28 BST 2010


Em Terça-feira 05 Outubro 2010, às 14:21:58, Lubos Lunak escreveu:
>  Thanks for saving me the work of refuting your first paragraph by doing so
> in your second paragraph :). And note that at least with gcc NULL already
> is nullptr in practice.

C++ is also happy to convert from pointer to bool if it can. That's why we 
added the private constructor QVariant::QVariant(void*) to Qt 4.7.

The worst part in my opinion is that C++ also happily converts "false" to 
pointer. (false is 0 and 0 can be a pointer)

$ g++ -fsyntax-only -xc++ - <<<'void foo(void *); int main() { foo(false); }'; 
echo $?
0
$ g++ -fsyntax-only -xc++ - <<<'void foo(void *); int main() { foo(true); }'; 
echo $?
<stdin>: In function ‘int main()’:
<stdin>:1: error: cannot convert ‘bool’ to ‘void*’ for argument ‘1’ to ‘void 
foo(void*)’
1

-- 
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 2010  -  Munich Oct 11-13  -  San Francisco Nov 1-3
For more information and to register: http://qt.nokia.com/qtdevdays2010
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101005/7db65a99/attachment.sig>


More information about the kde-core-devel mailing list