Updated Style and Coding Conventions

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jun 2 07:07:28 UTC 2014


Hello Gedare,

thanks for the summary.  I have some comments.

"Exception: Spaces are optional around binary bit-wise operators."

What is the background for this exception?  So "a&b" is ok, but not "a&&b"?  I 
would remove this exception.  I think "a & b" is much easier to read.

"Put a single space before and no space after unary pointer operators (* and &)."

What about "!a" vs. "! a"?  We have both variants currently.

"Use NULL for the null pointer."

What is with tests for the null pointer, e.g. "!ptr" vs "ptr != NULL".  I 
strongly favor the "ptr != NULL" test.  This is also in line with MISRA C and 
other standards in that area (only expressions with a boolean result value are 
allowed in if statements).

We should add a rule for unused function parameters:

"Use '(void) unused;' to mark unused parameters."

This works without special attributes and uses vertical space, so long function 
declarations are avoided.

On 2014-05-29 23:03, Gedare Bloom wrote:
> Hi,
>
> Please have a look http://www.rtems.org/wiki/index.php/Coding_Conventions
>
> I included some of the recent discussion points we've had, and some
> other points that come up often during code review.
>
> Gedare
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel
>


-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list