[Qt-interest] qobject_cast<> questions
Thiago Macieira
thiago.macieira at trolltech.com
Sun May 31 11:29:40 CEST 2009
Ross Bencina wrote:
>Hi Thiago
>
>>Please bear in mind that we cannot and will not document every single
>>aspect of the behaviour of Qt. There are things that will always be
>> left unexplained and undocumented, as a way of leaving the engineers
>> some manoeuvring room when expanding the API.
>
>I appreciate that.. but I would think a mechanism as fundamental as
>qobject_cast<> should be specified with the same rigor as dynamic_cast<>
> in C++. Even if just to add a line to the docs "if you pass 0 the
> behavior is undefined, don't do it!" -- at least then I would know to
> not call it with a 0 parameter (even though I can do that with
> dynamic_cast). These kind of edge cases are where the bugs often happen
> as you know.
I would add that line, if it were the case.
But I argue that we shouldn't need to document when things work exactly as
expected. If qobject_cast is meant to work as a replacement for
dynamic_cast, then it should work like it.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- 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/20090531/97d2cd85/attachment.bin
More information about the Qt-interest-old
mailing list