Coding Style for RTEMS

Chris Johns chrisj at rtems.org
Tue Dec 4 21:22:01 UTC 2012


Sebastian Huber wrote:
> On 04/12/12 14:00, Joel Sherrill wrote:
>> On 12/04/2012 12:31 PM, Gedare Bloom wrote:
>>>
>>> While I'm not so sure that having two coding styles is a great idea,
>>> I think it will be easiest to maintain the existing "RTEMS Style" in
>>> the score. I'd be on-board with adopting the freebsd style guide to
>>> fit RTEMS, I think that a codified set of rules will be nice to have.
>>> Joel had an Asciidoc floating around that described the RTEMS Style,
>>> but it wasn't complete.
>>>
>> How incomplete is up for debate. :)
>>
>> I have attached what I have and there is a Wiki page which
>> also captures some of the rules.
>>
>> http://www.rtems.org/wiki/index.php/Coding_Conventions
>>
>> My cynical view is that no one but me has ever written a line
>> on Coding Style, there was no auto-reformatting, no way to
>> reformat non-conformant code, and thus it was easy for
>> those who didn't like the style to ignore it.
>
> The score style is pretty easy to capture from the source. The score is
> not the problem. The big problem is the code outside the score, e.g.
> shell, file systems, bdbuf, BSPs.

I agree. An example is the RFS which is a specific style and common 
within itself. Its naming allows it to be removed from the source tree 
to make a host tool.

>> I am also happy to discuss coding standards from NASA, ESA,
>> JPL, MISRA, etc. but they better make sense for RTEMS and
>> be enforceable by free tools.
>
> Ok, a coding standard is quite complex and taking all this into account
> can be a matter of years. Some MISRA rules are quite questionable for
> example. Standards may contradict each other.

I agree we may look at the available standards but an RTEMS standard 
needs to stand alone and be self contained.

> I have not problems with the score style personally. My only concern is
> that it makes it harder for newcomers since a lot more people already
> know the BSD, Linux or GNU style.

Are we talking about a single style for all "RTEMS" code ? Does this 
extend to function and variable naming ?

Chris



More information about the devel mailing list