[Qt-interest] [OT] Adding arbitrary depth to Graphics Scene & Friends
Kishore
kitts.mailinglists at gmail.com
Mon May 2 06:18:31 CEST 2011
On Monday 02 May 2011 3:21:06 AM Andre Poenitz wrote:
> On Sat, Apr 30, 2011 at 09:11:22AM +0530, Kishore wrote:
> > On Wednesday 27 Apr 2011 10:17:20 PM Jason H wrote:
> > > In theory no, but in practice yes.
> > > You'll have to make a QAppliction instance, but you [probably] won't
> > > have to call app.exec().
> > >
> > > main ()
> > > {
> > > QApplication app;
> > > QGraphicsView gv...
> > >
> > > /* do your manipulation here */
> > > /* do your output here */
> > > /* no need for exec (most likely) */
> > >
> > > return 0;
> > > }
> >
> > I don't know how compiler optimizations work in such a case, but is it
> > possible that it completely avoids the creation of app since it is not
> > actually used anywhere below?
>
> The compiler is (as usual) free to apply the as-if rule: If it is able to
> prove that the QApplication constructor does not change the user visible
> behaviour it is free to omit it.
>
> I seriously doubt that proof is possible...
Which would largely mean that it can do so only for basic data types. This was
a concern i had when i recently wanted to implement a lock class which locks a
resource when created and then automatically unlocked the resource when
destructed automatically by the compiler.
I guess i am safe with that method with any sane compiler.
--
Cheers!
Kishore
More information about the Qt-interest-old
mailing list