mesos-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Mathiske (JIRA)" <>
Subject [jira] [Commented] (MESOS-2211) Include guard naming fixup
Date Wed, 21 Jan 2015 08:15:34 GMT


Bernd Mathiske commented on MESOS-2211:

Expanding on what Ben wrote above.

In case you don't go with the pragma solution, note that there is no reason to include the
ENTIRE path in the #define statements. Usually, prefixing with just MESOS, LIBPROCESS, or
STOUT suffices. This alone already solves the problem of conflicts with external files. 

What remains are internal conflicts due to identical file names inside Mesos, libprocess,
or stout. Solutions:
a) Ban using the exact same file name inside our code base.
b) Optionally prefix the dir closest to the leaf. This should normally suffice. It not, add
more going up the path incrementally as needed.

> Include guard naming fixup
> --------------------------
>                 Key: MESOS-2211
>                 URL:
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Till Toenshoff
>            Assignee: Kapil Arya
>            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

View raw message