[Qt-interest] Can you spot my mistake.

Thiago Macieira thiago.macieira at trolltech.com
Mon Aug 24 10:24:26 CEST 2009


Em Segunda-feira 24 Agosto 2009, às 10:11:05, Andrew Hodgkinson escreveu:
> On 24/08/2009 00:12, william.crocker at analog.com wrote:
> >> Your myapp constructor doenst take in a reference to argc
> >
> > That is correct.
> 
> So why *is* QApplication's constructor defined with "int & argc", rather
> than just "int argc"? Isn't that just asking for trouble?

Why do you pass something by reference, instead of by value?

Because it's going to be changed. QApplication and QCoreApplication modify the 
parameter lists to the application, reordering and removing elements that they 
have already parsed.

> > Easy to miss and of dire consequences.
> 
> Out of interest, given it took a long time for the symptoms to surface -
> what were they? Others on the list (including me) may encounter the same
> thing one day and who knows, they may remember this thread.
> 

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Development Frameworks
     Sandakerveien 116, NO-0402 Oslo, Norway

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/20090824/0e3ccff5/attachment.bin 


More information about the Qt-interest-old mailing list