Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

be consistent with how we format headers #301

Merged
merged 1 commit into from
Feb 22, 2017
Merged

be consistent with how we format headers #301

merged 1 commit into from
Feb 22, 2017

Conversation

ppannuto
Copy link
Member

We were close to a consensus on most of this, but now everything
follows the same format:

`#pragma once` directive
[newline]
System headers in <>'s
[newline]
Tock headers in ""'s
[newline]
C++ guard
[newline]
#define's
[newline]
function prototypes
[newline]
C++ guard

The only real changes / decisions:

  • #pragma once instead of include guards. We were about 50/50.
    I think the pragma looks cleaner and is easier, so I went that way.
  • C++ open guard above defines. We were about 75/25 this way already.
    I think this is easier to parse as it groups the things this header
    is defining together instead of putting this random build artifact
    in the middle
  • Add missing C++ guards. Only a few files had forgotten them. I don't
    think any files were #define only, but even if they were, I'd be
    inclined to still include the guards to be consistent across all
    headers and more importantly to reduce the chance that it's forgetten
    if a method is added.

We were close to a consensus on most of this, but now everything
follows the same format:

    `#pragma once` directive
    [newline]
    System headers in <>'s
    [newline]
    Tock headers in ""'s
    [newline]
    C++ guard
    [newline]
    #define's
    [newline]
    function prototypes
    [newline]
    C++ guard

The only real changes / decisions:

 - `#pragma once` instead of include guards. We were about 50/50.
   I think the pragma looks cleaner and is easier, so I went that way.
 - C++ open guard above defines. We were about 75/25 this way already.
   I think this is easier to parse as it groups the things this header
   is defining together instead of putting this random build artifact
   in the middle
 - Add missing C++ guards. Only a few files had forgotten them. I don't
   think any files were #define only, but even if they were, I'd be
   inclined to still include the guards to be consistent across all
   headers and more importantly to reduce the chance that it's forgetten
   if a method is added.
@alevy
Copy link
Member

alevy commented Feb 22, 2017

Agree with all the points...

@alevy alevy merged commit 9de51c2 into master Feb 22, 2017
@alevy alevy deleted the header-cleanup branch February 22, 2017 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants