VirtualBox

Changeset 55951 in vbox for trunk/include/iprt/cdefs.h


Ignore:
Timestamp:
May 19, 2015 11:48:06 PM (10 years ago)
Author:
vboxsync
Message:

iprt/cdefs.h,iprt/err.h: More or less deprecated RT_UNLIKELY and RT_FAILURE in favor of code organized around RT_LIKELY and RT_SUCCESS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cdefs.h

    r55468 r55951  
    13211321 * A few notes about the usage:
    13221322 *
     1323 *      - Generally, order your code use RT_LIKELY() instead of RT_UNLIKELY().
     1324 *
    13231325 *      - Generally, use RT_UNLIKELY() with error condition checks (unless you
    13241326 *        have some _strong_ reason to do otherwise, in which case document it),
     
    13281330 *      - Other than that, if you don't know the likelihood of a test succeeding
    13291331 *        from empirical or other 'hard' evidence, don't make predictions unless
    1330  *        you happen to be a Dirk Gently.
     1332 *        you happen to be a Dirk Gently character.
    13311333 *
    13321334 *      - These macros are meant to be used in places that get executed a lot. It
     
    13361338 *
    13371339 *      - Note that RT_SUCCESS() and RT_FAILURE() already makes use of RT_LIKELY()
    1338  *        and RT_UNLIKELY(). Should you wish for prediction free status checks,
     1340 *        and RT_UNLIKELY().  Should you wish for prediction free status checks,
    13391341 *        use the RT_SUCCESS_NP() and RT_FAILURE_NP() macros instead.
    13401342 *
     
    13421344 * @returns the boolean result of the expression.
    13431345 * @param   expr        The expression that's very likely to be true.
    1344  * @see RT_UNLIKELY
     1346 * @see     RT_UNLIKELY
    13451347 */
    13461348/** @def RT_UNLIKELY
     
    13511353 * @returns the boolean result of the expression.
    13521354 * @param   expr        The expression that's very unlikely to be true.
    1353  * @see RT_LIKELY
     1355 * @see     RT_LIKELY
     1356 *
     1357 * @remarks Please use RT_LIKELY() instead wherever possible!  That gives us a
     1358 *          better chance of the windows compilers to generate favorable code
     1359 *          too.  The belief is that the compiler will by default assume the
     1360 *          if-case is more likely than the else-case.
    13541361 */
    13551362#if defined(__GNUC__)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette