You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Cody Maloney (JIRA)" <ji...@apache.org> on 2015/01/09 23:15:35 UTC
[jira] [Comment Edited] (MESOS-2211) Include guard naming fixup
[ https://issues.apache.org/jira/browse/MESOS-2211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14271949#comment-14271949 ]
Cody Maloney edited comment on MESOS-2211 at 1/9/15 10:15 PM:
--------------------------------------------------------------
\+1 for `#pragma once`. It isn't standard C++, but every C++11 compiler supports them (And some that don't support C++11)
Major improvements
- Hard to mess up (There are special shortcut parsing paths around #pramga once and include guards inside compilers which give a large compile speed improvement)
- There aren't conflicts with C++ reserved identifiers (http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier)
Underscore followed by upper case letter (our current scheme) is a language reserved keyword.
was (Author: cmaloney):
+1 for `#pragma once`. It isn't standard C++, but every C++11 compiler supports them (And some that don't support C++11)
Major improvements
- Hard to mess up (There are special shortcut parsing paths around #pramga once and include guards inside compilers which give a large compile speed improvement)
- There aren't conflicts with C++ reserved identifiers (http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier)
Underscore followed by upper case letter (our current scheme) is a language reserved keyword.
> Include guard naming fixup
> --------------------------
>
> Key: MESOS-2211
> URL: https://issues.apache.org/jira/browse/MESOS-2211
> Project: Mesos
> Issue Type: Bug
> Reporter: Till Toenshoff
> Priority: Trivial
> Labels: newbie
>
> Triggered by a comment in a review request, I noticed that we currently have no consistent style for naming include guards.
> Examples:
> include/mesos/resources.hpp: {{#define __RESOURCES_HPP__}}
> include/mesos/executor.hpp: {{#define __MESOS_EXECUTOR_HPP__}}
> include/mesos/mesos.hpp: {{#define __MESOS_HPP__}}
> I think the **right** way would be stating the path and include file name within the guard, so the above at fault become:
> include/mesos/resources.hpp: {{#define __MESOS_RESOURCES_HPP__}}
> include/mesos/mesos.hpp: {{#define __MESOS_MESOS_HPP__}}
> Everything from include/XXX should have a __XXX_ prefix in its guard name, anything from src/XXX should have a __XXX_ prefix. This should also apply to multiple folder levels; e.g. include/XXX/YYY/FOO should have a __XXX_YYY_FOO prefix.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)