On Donnerstag, 25. Juli 2013 11:53:20 CEST, Pali Rohár wrote:


In our case (in Trojita), we have KGlobal::hasMainComponent()

What sets KGlobal::newComponentData() and why does it pass a junk name?
I'd suggest to fix that.
(The KComponentData constructors do so, when passed RegisterAsMainComponent)

What other developers think?
The code is safe and will work - at the moment.

In general I would however resist from const casting non-internal stuff (the "I 
wrote that and I know what I do here" case) if any avoidable, eg. 
KGlobal::mainComponent() could all out of a sudden return a(n implicitly shared) 
temporary (though signature changing is not ABI stable, the temporary could also be drawn 
internally)

Your code would still compile and operate w/o crashing - just not do what you 
expect it to do.

Cheers,
Thomas

Reply via email to