[gnome-devel-docs] programming-guidelines: Improve namespacing recommendations for headers
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-devel-docs] programming-guidelines: Improve namespacing recommendations for headers
- Date: Fri, 15 Jan 2016 13:12:36 +0000 (UTC)
commit bc9a95a9598a2916083c9dd303723db152a68f2e
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Jan 15 13:11:33 2016 +0000
programming-guidelines: Improve namespacing recommendations for headers
Public headers should be namespaced in a directory, but there’s no need
to namespace their filenames as well. To do so is redundant.
Change advice from
#include <namespace/ns-filename.h>
to
#include <namespace/filename.h>
programming-guidelines/C/namespacing.page | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/programming-guidelines/C/namespacing.page b/programming-guidelines/C/namespacing.page
index bf9398c..c90ef58 100644
--- a/programming-guidelines/C/namespacing.page
+++ b/programming-guidelines/C/namespacing.page
@@ -9,7 +9,7 @@
<credit type="author copyright">
<name>Philip Withnall</name>
<email its:translate="no">philip withnall collabora co uk</email>
- <years>2015</years>
+ <years>2015, 2016</years>
</credit>
<include href="cc-by-sa-3-0.xml" xmlns="http://www.w3.org/2001/XInclude"/>
@@ -92,7 +92,14 @@
Additionally, public headers should be included from a subdirectory,
effectively namespacing the header files. For example, instead of
<code>#include <abc.h></code>, a project should allow its users to
- use <code>#include <namespace/ns-abc.h></code>.
+ use <code>#include <namespace/abc.h></code>.
+ </p>
+
+ <p>
+ Some projects namespace their headers within this subdirectory — for
+ example, <code>#include <namespace/ns-abc.h></code> instead of
+ <code>#include <namespace/abc.h></code>. This is redundant, but
+ harmless.
</p>
<p>
@@ -102,10 +109,10 @@
</p>
<list>
<item><p>
- <file><var>$(includedir)</var>/walbottle-<var>$API_MAJOR</var>/walbottle/wbl-schema.h</file>
+ <file><var>$(includedir)</var>/walbottle-<var>$API_MAJOR</var>/walbottle/schema.h</file>
</p></item>
<item><p>
- <file><var>$(includedir)</var>/walbottle-<var>$API_MAJOR</var>/walbottle/wbl-writer.h</file>
+ <file><var>$(includedir)</var>/walbottle-<var>$API_MAJOR</var>/walbottle/writer.h</file>
</p></item>
</list>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]