mesos-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Mann (JIRA)" <>
Subject [jira] [Commented] (MESOS-2211) Include guard naming fixup
Date Fri, 12 Aug 2016 21:40:20 GMT


Greg Mann commented on MESOS-2211:

This just came up in a review, so I'm adding my comments here. I would propose one of the
following 3 approaches, in my personal order of preference:

* Use both {{#define}} guards _and_ {{#pragma once}}. This gives us the best of both worlds,
with little effort.
* Use {{#pragma once}} since it's widely supported. As [~karya] suggested, we could amend
our style guide to accommodate this.
* Use {{#define}} guards which contain the full path in the guard. Verbosity in include guards
is not something that I'm worried about, and this provides a dead simple way to ensure a unique
name for every guard.

> Include guard naming fixup
> --------------------------
>                 Key: MESOS-2211
>                 URL:
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Till Toenshoff
>            Priority: Trivial
>              Labels: mesosphere
> 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

View raw message