[Interest] How does one use Q_ASSUME?

René J.V. Bertin rjvbertin at gmail.com
Sat May 25 10:12:12 CEST 2019


Hi,

I can't seem to wrap my head around what one can do with Q_ASSUME, i.e. which will be the code for which the compiler won't emit code (and how the compiler could know not to emit code as a function of a runtime condition?!)

Squinting at the macros it seems evident that you cannot do something like this, which to me the documentation suggests (and I think) you SHOULD be able to do:

Q_ASSUME(conditionsMet, {
  // do something that should be done only when conditions are met
});


R


More information about the Interest mailing list