summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-27 16:17:02 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-27 16:17:02 +0000
commited080069ec7b1192177e4cff7aa92dcf194f6258 (patch)
treecedacf8c7aae7f73e19975e19977fb292fd3f99d
parent5b0e3304ec1168bc31bbdb42cfbc4a4641adfc80 (diff)
downloadATCD-ed080069ec7b1192177e4cff7aa92dcf194f6258.tar.gz
ChangeLogTag:Wed Jan 27 10:16:06 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--ChangeLog-99b6
-rw-r--r--docs/ACE-guidelines.html87
2 files changed, 93 insertions, 0 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index 4535b422ee8..0dc62801367 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,9 @@
+Wed Jan 27 10:16:06 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * docs/ACE-guidelines.html:
+ Added an entry for the creation of files containing template
+ code.
+
Tue Jan 26 20:44:36 1999 Nanbor Wang <nanbor@cs.wustl.edu>
* ace/SOCK_IO.cpp (send,recv): Changed to use sendv/recvv to
diff --git a/docs/ACE-guidelines.html b/docs/ACE-guidelines.html
index dc88f70d827..f220edb1c07 100644
--- a/docs/ACE-guidelines.html
+++ b/docs/ACE-guidelines.html
@@ -215,6 +215,86 @@ bgcolor="#ffffff">
<strong>No</strong> code can appear after the final
<code>#endif</code> for the optimization to be effective and
correct.<p>
+
+ <li><P>Files that contain parametric classes should follow this style:
+ <PRE>
+ #ifndef FOO_T_H
+ #define FOO_T_H
+
+ #include "ace/ACE.h"
+ #if !defined (ACE_LACKS_PRAGMA_ONCE)
+ # pragma once
+ #endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ // Put your template declarations here...
+
+ #if defined (__ACE_INLINE__)
+ #include "Foo_T.i"
+ #endif /* __ACE_INLINE__ */
+
+ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+ #include "Foo_T.cpp"
+ #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+ #pragma implementation "Foo_T.cpp"
+ #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+ #endif /* FOO_T_H */
+</PRE></P>
+ <P>
+ Notice that some compilers need to see the code of the template,
+ hence the <CODE>.cpp</CODE> file must be included from the
+ header file.
+ </P>
+ <P>
+ To avoid multiple inclusions of the <CODE>.cpp</CODE> file it
+ should also be protected as in:
+ <pre>
+ #ifndef FOO_T_C
+ #define FOO_T_C
+
+ #include "Foo_T.h"
+ #if !defined (ACE_LACKS_PRAGMA_ONCE)
+ # pragma once
+ #endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ #if !defined (__ACE_INLINE__)
+ #include "ace/Active_Map_Manager_T.i"
+ #endif /* __ACE_INLINE__ */
+
+ ACE_RCSID(lib, Foo_T, "$<!-- -->Id$")
+
+ // put your template code here
+
+ #endif /* FOO_T_H */
+</pre></p>
+ <P>
+ Finally you may want to include the template header file from a
+ non-template header file (check
+ <CODE>$ACE_ROOT/ace/Synch.h</CODE>); in such a case the template
+ header should be included <strong>after</strong> the inline
+ function definitions, as in:</P>
+ <P><PRE>
+ #ifndef FOO_H
+ #define FOO_H
+
+ #include "ace/ACE.h"
+ #if !defined (ACE_LACKS_PRAGMA_ONCE)
+ # pragma once
+ #endif /* ACE_LACKS_PRAGMA_ONCE */
+
+ // Put your non-template declarations here...
+
+ #if defined (__ACE_INLINE__)
+ #include "Foo.i"
+ #endif /* __ACE_INLINE__ */
+
+ #include "Foo_T.h"
+
+ #endif /* FOO_H */
+</PRE></P>
+ </li>
</ul>
<li><strong>C++ Syntax and Constructs</strong><p>
@@ -490,6 +570,13 @@ bgcolor="#ffffff">
<li>Functions should always return -1 to indicate failure, and
0 or greater to indicate success.<p>
+
+ <li><P>Separate the code of your templates from the code for
+ non-parametric classes: some compilers get confused when
+ template and non-template code is mixed in the same file.
+ </P>
+ </li>
+
</ul>
<li><strong>I/O</strong><p>