VirtualBox

Changeset 16542 in vbox


Ignore:
Timestamp:
Feb 6, 2009 11:11:51 AM (16 years ago)
Author:
vboxsync
Message:

iprt/assert.h: added AssertForEach

File:
1 edited

Legend:

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

    r15668 r16542  
    22462246#endif
    22472247
     2248/** @def AssertForEach
     2249 * Equivalent to Assert for each value of the variable from the starting
     2250 * value to the finishing one.
     2251 *
     2252 * @param   var     Name of the counter variable
     2253 * @param   vartype Type of the counter variable
     2254 * @param   first   Lowest inclusive value of the counter variable.  This must
     2255 *                  be free from side effects.
     2256 * @param   last    Highest exclusive value of the counter variable.  This
     2257 *                  must be free from side effects.
     2258 * @param   expr    Expression which should be true for each value of @a var.
     2259 * @param   name    Name of the precondition
     2260 */
     2261#define AssertForEach(var, vartype, first, last, expr) \
     2262do { \
     2263    vartype var; \
     2264    Assert(((first) == (first)) && ((last) == (last))); /* partial check for side effects */ \
     2265    for (var = (first); var < (last); ++var) \
     2266        AssertMsg(expr, ("%s = %lld", #var, var)); \
     2267} while(0)
     2268
    22482269/** @} */
    22492270
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