Changeset 55951 in vbox
- Timestamp:
- May 19, 2015 11:48:06 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100450
- Location:
- trunk/include/iprt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cdefs.h
r55468 r55951 1321 1321 * A few notes about the usage: 1322 1322 * 1323 * - Generally, order your code use RT_LIKELY() instead of RT_UNLIKELY(). 1324 * 1323 1325 * - Generally, use RT_UNLIKELY() with error condition checks (unless you 1324 1326 * have some _strong_ reason to do otherwise, in which case document it), … … 1328 1330 * - Other than that, if you don't know the likelihood of a test succeeding 1329 1331 * 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. 1331 1333 * 1332 1334 * - These macros are meant to be used in places that get executed a lot. It … … 1336 1338 * 1337 1339 * - 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, 1339 1341 * use the RT_SUCCESS_NP() and RT_FAILURE_NP() macros instead. 1340 1342 * … … 1342 1344 * @returns the boolean result of the expression. 1343 1345 * @param expr The expression that's very likely to be true. 1344 * @see RT_UNLIKELY1346 * @see RT_UNLIKELY 1345 1347 */ 1346 1348 /** @def RT_UNLIKELY … … 1351 1353 * @returns the boolean result of the expression. 1352 1354 * @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. 1354 1361 */ 1355 1362 #if defined(__GNUC__) -
trunk/include/iprt/err.h
r55659 r55951 162 162 163 163 /** @def RT_FAILURE 164 * Check for failure. We don't expect in normal cases, that is the code path depending on 165 * this check is normally NOT taken. To prevent any prediction use RT_FAILURE_NP instead. 164 * Check for failure, predicting unlikely. 165 * 166 * We don't expect in normal cases, that is the code path depending on this 167 * check is normally NOT taken. To prevent any prediction use RT_FAILURE_NP 168 * instead. 166 169 * 167 170 * @returns true if rc indicates failure. … … 169 172 * 170 173 * @param rc The iprt status code to test. 174 * 175 * @remarks Please structure your code to use the RT_SUCCESS() macro instead of 176 * RT_FAILURE() where possible, as that gives us a better shot at good 177 * code with the windows compilers. 171 178 */ 172 179 #define RT_FAILURE(rc) ( RT_UNLIKELY(!RT_SUCCESS_NP(rc)) ) 173 180 174 181 /** @def RT_FAILURE_NP 175 * Check for failure . Don't predict the result.182 * Check for failure, no prediction. 176 183 * 177 184 * @returns true if rc indicates failure.
Note:
See TracChangeset
for help on using the changeset viewer.