Qt branch updates

Thiago Macieira thiago at macieira.org
Sun May 12 14:32:17 PDT 2013


On domingo, 12 de maio de 2013 10.42.00, Dirk Hohndel wrote:
> > 1- QItemSelection selection; instead of = QItemSelection(); there's no
> > need
> > to equal a new object with another if what you want is a stack allocated
> > memory ( on the heap you need a 'new' or malloc)
> 
> So if I just use the object all is initialized to sane default values? Good.

Yes. If you do:

	Foo obj;

then Foo's default constructor is called (the constructor that can take 0 
arguments) to initialise the object.

If you write:
	Foo obj = Foo();

then strictly speaking the compiler would have to create a temporary, call the 
default constructor on it, then call the copy constructor, and finally the 
destructor on the temporary. However, there's a permitted optimisation by the 
standard that the latter is equal to the former.

So it will just save you a few keystrokes.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- 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://lists.hohndel.org/pipermail/subsurface/attachments/20130512/d98adedd/attachment.sig>


More information about the subsurface mailing list