[
https://issues.apache.org/jira/browse/MESOS-2211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14271916#comment-14271916
]
Michael Park commented on MESOS-2211:
-------------------------------------
+1 for {{#pragma once}}.
- It allows for us not to come up with a naming scheme and put effort into
keeping it consistent all across the codebase.
- Every known C++ compiler supports it.
- As Tim mentioned above, the guard names would get really long if we were to
do it properly.
- Also, for "external" libraries like {{libprocess}} and {{stout}}, the path
would have to start within its own root directory. In which case we're back to
the possibility for running into conflicting names.
Overall, I think {{#pragma once}} is simpler, easier to get right which
relieves unnecessary overhead for programmers.
[~benjaminhindman]: thoughts on this? was it decided not to use {{#pragma
once}} at some point or has it not been discussed previously?
> 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)