10.125 __promise intrinsic

This intrinsic represents a promise you make to the compiler that a given expression always has a nonzero value. This enables the compiler to perform more aggressive optimization when vectorizing code.


void __promise(expr)

Where expr is an expression that evaluates to nonzero.


__promise(expr) is similar but complementary to assert(expr). Unlike assert(expr), __promise(expr) is effective when NDEBUG is defined.

If assertions are enabled (by including assert.h and not defining NDEBUG) then the promise is checked at runtime by evaluating expr as part of assert(expr).

Related concepts
3.19 Indicating loop iteration counts to the compiler with __promise(expr)
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.