[Development] Upgrading the sources to C++11 keywords (Q_NULLPTR, etc.)

Marc Mutz marc.mutz at kdab.com
Thu Jul 23 14:43:20 CEST 2015


On Thursday 08 January 2015 23:33:34 Thiago Macieira wrote:
> Non-C++11 but also useful:
> 
>  * Q_DECL_{PURE,CONST}_FUNCTION - encouraged
> 
> A pure function is a function that will return the same value if called
> twice  with the same parameters. Pure functions are allowed to read from
> pointers passed to it, including the "this" pointer. Pure functions are
> not allowed to have observable side-effects (rule of thumb: no writing to
> dereferenced pointers or to global variables).
> 
> A const function is a function that is pure and does not dereference any 
> pointers.
> 
> Quite by definition, const and pure functions cannot return void. Any such 
> calls would be discarded by the compiler.

Consensus, I think? Esp. useful for out-of-line qHash(), e.g.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list