On Saturday May 25 2019 11:05:39 Elvis Stansvik wrote:

> E.g.
> 
> Q_ASSUME(!atWar);
> 
> if (atWar) {
>     fireNukes(); <-- Oops, nukes may not be fired, even if at war,
> because compiler may have taken the hint and assumed we're not at war
> }
> 
> Microsoft seems to have a nice article about their __assume (which
> Q_ASSUME expands to):
> https://docs.microsoft.com/en-us/cpp/intrinsics/assume?view=vs-2019


I'll have a look, maybe it confirms your idea of how this might be used.


> I don't understand. That just looks like an if statement?

Yes, one that could expand to

if (__assume(condition)) {
}

this would seem a bit more in line with comparable compiler directives that 
influence how (or if) branches are taken, like the *likely directives or llvm's 
__builtin_available directive.

R
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to