[Qt-interest] Can you spot my mistake.
Thomas Dähling
t.daehling at googlemail.com
Mon Aug 24 16:53:47 CEST 2009
Personally I am even curious why it is not doing a simple value copy
of argc anyway? I do not see a specific reason for passing a reference
there.
2009/8/24, Andrew Hodgkinson <ahodgkinson at endurancetech.co.uk>:
> On 24/08/2009 15:33, John McClurkin wrote:
>
>> Well, it's not problematic for those who expect and exploit that
>> behavior.
>
> The use of a reference type seems to be an issue, because we have a
> thread in which several contributors describe their encounter with the
> same problem as the OP. I suppose this is a wider C++ consideration;
> imagine that we used this QApplication constructor instead:
>
> QApplication(int * argc, char ** argv) {}
>
> Now we try to implement MyApp as before:
>
> MyApp(int argc, char ** argv) : QApplication(argc, argv) {}
>
> Before, the code would compile with no warnings, link, run and eventually
> crash. Now it won't even compile and the compiler's error would make the
> mistake very obvious.
>
> Does anyone know why a reference rather than a pointer is seen as a
> better choice in this particular case?
>
> --
> TTFN, Andrew Hodgkinson
> Find some electronic music at: Photos, wallpaper, software and more:
> http://pond.org.uk/music.html http://pond.org.uk/
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list