Changes between Version 97 and Version 98 of Developer/Coding/Conventions


Ignore:
Timestamp:
Apr 15, 2017, 12:50:46 AM (2 years ago)
Author:
Gedare Bloom
Comment:

Add new rule regarding explicit checking of bits in variables.

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Coding/Conventions

    v97 v98  
    2828 *  Do not use compiler extensions.
    2929 *  Use the RTEMS_ macros defined in score/basedefs.h for abstracting compiler-specific features.
    30  *  Use NULL for the null pointer, and prefer to use explicit checks against NULL, e.g. 'if ( ptr != NULL )' instead of 'if ( !ptr )'.
     30 *  Use NULL for the null pointer, and prefer to use explicit checks against NULL, e.g., `if ( ptr != NULL )` instead of `if ( !ptr )`.
     31 *  Use explicit checks for bits in variables.
     32   *  Example 1: Use `if ( XBITS == (var & XBITS) )` to check for a set of defined bits.
     33   *  Example 2: Use `if ( (var & X_FLAGS) != 0) )` instead of `if ( !!(var & X_FLAGS) )` to check for at least 1 defined bit in a set.
    3134 *  Use '(void) unused;' to mark unused parameters and set-but-unused variables immediately after being set.
    3235 *  Do not put function prototypes in C source files, any global functions should have a prototype in a header file and any private function should be declared static.