Updated Style and Coding Conventions
Gedare Bloom
gedare at rtems.org
Mon Jun 2 13:44:49 UTC 2014
On Mon, Jun 2, 2014 at 3:07 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> 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.
>
There is precedence especially for bitwise-orring of flag fields it
seems to have been done in the past. However, I have removed the
exception, I agree with both of you that it is better to have the
spaces.
> "Put a single space before and no space after unary pointer operators (* and
> &)."
>
> What about "!a" vs. "! a"? We have both variants currently.
>
I meant to include the ! operator, and now I have clarified this rule.
We do have both, but we should avoid the "! a" variant I believe.
> "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).
>
I have made it a suggestion to prefer explicit checks for NULL.
> We should add a rule for unused function parameters:
>
> "Use '(void) unused;' to mark unused parameters."
>
Done.
> 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.
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel
More information about the devel
mailing list