C++ Guide for RTEMS Tools?

Chris Johns chrisj at rtems.org
Wed Aug 28 07:24:35 UTC 2019


On 28/8/19 4:05 pm, Jonathan Brandmeyer wrote:
> On Tue, Aug 27, 2019 at 12:08 PM Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>>
>> Hello,
>>
>> since C++ and Python seems to be the preferred languages for RTEMS Tools I think we need also a C++ guide. I would not re-invent the wheel and just pick up something existing. The Google C++ Style doesn't seem to be completely stupid and it is supported out of the box by clang-format. So, my proposal is to just use it along with:
>>
>> clang-format -style=Google -i some-file.cc
> 
> If RTEMS is going to adopt clang-format, I suggest that you provide a
> .clang-format file in the source root that captures your preferences.
> That way, if you choose to use Google style + deviations its
> straightforward to do so.  The command becomes `clang-format
> -style=file -i some-file.cc` which is the most common way that
> third-party tools use it anyway.
> 
>>
>> The Google C++ Style leaves some white space choices undefined. If we choose this style, these gaps should be closed for RTEMS.
> 
> Using a .clang-format file makes it easier to express exactly where
> RTEMS falls on some of those choices.  For example, the Google base
> style uses majority-vote-in-this-file to align pointer and reference
> types' *, &, and &&.  If RTEMS has a stronger opinion, then just flip
> the appropriate switch in your .clang-format file.

Interesting and great advice. Thanks.

Chris



More information about the devel mailing list