C++ Guide for RTEMS Tools?
jbrandmeyer at planetiq.com
Wed Aug 28 06:05:56 UTC 2019
On Tue, Aug 27, 2019 at 12:08 PM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> 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.
More information about the devel