Review Request: Avoid setting a style that is already set

Hans Meine hans_meine at gmx.net
Tue Jun 1 14:44:28 BST 2010


On Sunday 30 May 2010 17:37:28 Matthias Fuchs wrote:
> > Christoph Feck wrote:
> >     Matthias, if Qt cannot find any style you have a bigger problem...
> >     
> >     Qt itself does not handle the cases where style is 0, it just uses
> >     style()->pixelMetric() etc. and it would be ridiculous to add a null
> >     check everywhere.
> 
> That argument is ok, but not that Qt asserts anyway because you cannot be
> sure what Qt is compiled like on the user's machine.

Note that that does not matter - the Q_ASSERT() indicates the /basic 
assumption/ that its argument will always hold, irrespective of QT_NO_DEBUG.

It is correct, however, that assertions must not be confused with runtime 
checks.  AFAICS it makes sense to use assertions for checking data coming from 
API clients, i.e. programmers, but not for user data, i.e. data read from 
files.

Have a nice day,
  Hans




More information about the kde-core-devel mailing list