]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Describe forward declarations in the style guide. 2332/head
authorDavid Wells <wellsd2@rpi.edu>
Fri, 11 Mar 2016 03:15:51 +0000 (22:15 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Fri, 11 Mar 2016 03:15:51 +0000 (22:15 -0500)
doc/doxygen/headers/coding_conventions.h

index cf8d091f3cdfb0a35f968e44836e97d3ecdc6652..b816f84d1d28344e0285efa3cd31a5e397239274 100644 (file)
@@ -134,6 +134,19 @@ style guidelines outlined in this page.</p>
   put before the data type specifier, i.e., we use Point<dim,number> and not
   Point<number,dim>.
 
+<li> There are several places in deal.II where we use forward declarations in
+  header files. The reason for this is that we can, hopefully, improve
+  compilation speeds by not using headers when we just need to mark a certain
+  type as an argument to a function. The convention used in deal.II is that, if
+  all we need is a type name, then the type may be forward declared in the
+  header where we need it; if a function (or member function) can return a value
+  then a declaration of that value's type should be available (by including the
+  necessary header). For example, <code>deal.II/dofs/dof_handler.h</code>
+  includes <code>deal.II/dofs/dof_accessor.h</code> so that one can write
+  something like <code>dof_handler.begin_active()->is_active()</code> without
+  explicitly including the header declaring the type of the object returned by
+  <code>begin_active()</code>.
+
 <li> Each class has to have at least 200 pages of documentation ;-)</li>
 
 </ol>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.