IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 505


Ignore:
Timestamp:
Apr 22, 2004, 12:33:38 PM (22 years ago)
Author:
Paul Price
Message:

Added discussion about Doxygen and the use of tags.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/misc/codeConventions.tex

    r501 r505  
    1 %%% $Id: codeConventions.tex,v 1.13 2004-04-22 20:30:32 eugene Exp $
     1%%% $Id: codeConventions.tex,v 1.14 2004-04-22 22:33:38 price Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    137137
    138138For an example of a properly formatted program, see
    139 Source File Example (sec. \ref{SourceExample}).
     139Source File Example (\S\ref{SourceExample}).
    140140
    141141\subsection{Source Files}
     
    233233
    234234When preparing documents, you should ensure that lines of this length
    235 are not wrapped\footnote{If you are using the standard PSDC \LaTeX{}
    236 class file \file{panstarrs.cls}, \CODE|\begin{verbatim}
    237 ... \end{verbatim}| will do this for you}.
     235are not wrapped.  If you are using the standard PSDC \LaTeX{} class
     236file \file{panstarrs.cls}, \CODE|\begin{verbatim} ... \end{verbatim}|
     237will do this for you.
    238238
    239239\subsection{Wrapping Lines}
     
    246246
    247247\begin{verbatim}
    248 if(a < b ||
    249    a > 2*b) {
    250     x = (a + b + c) +
    251     sin(z);
    252 }
     248    if(a < b ||
     249       a > 2*b) {
     250        x = (a + b + c) +
     251            sin(z);
     252    }
    253253\end{verbatim}
    254254
     
    393393describe.
    394394
    395 See also Documentation Comments (sec. \ref{DocComments}).
     395See also Documentation Comments (\S\ref{DocComments}).
    396396
    397397\subsubsection{Single-Line Comments}
     
    400400Short comments can appear on a single line indented to the level of
    401401the code that follows. If a comment can't be written in a single line,
    402 it should follow the \ref{ImplBlockComments}block comment format.
     402it should follow the block comment format (\S\ref{ImplBlockComments}).
    403403
    404404\subsubsection{Trailing Comments}
     
    440440\label{DocComments}
    441441
    442 \tbd{Need references to Doxygen here.}
     442Doxygen\footnote{{\tt  www.doxygen.org}}  will   be  used  to  produce
     443documentation of the types,  functions and variables without requiring
     444much  extra  effort  for   the  programmer.   Comments  starting  with
     445particular characters  (``tags'') are used by Doxygen  to identify the
     446relevant code to be documented.
     447
     448Functions shall be tagged for Doxygenation by pre-pending them with a
     449block comment (\S\ref{ImplBlockComments}) which starts with a
     450\code{/**} instead of the usual \code{/*}.
     451
     452Variables shall be tagged for Doxygenation by appending their
     453declaration with an end-of-line comment which starts with a
     454\code{///<} instead of the usual \code{//}.
     455
     456An example of a function definition employing Doxygen-compatible
     457comments follows:
     458
     459\begin{verbatim}
     460/** This is a really cool function.
     461 *  It does many really cool things.
     462 */
     463int reallyCoolFunction(int aNumber,     ///< This is a number
     464                       float aRealNumber ///< This is a real number
     465                       )
     466{
     467    char *aString;                      ///< This is a string used to do stuff.
     468
     469    /* Do really cool stuff */
     470    ...
     471}
     472\end{verbatim}
    443473
    444474If you need to give information about a type, interface, or variable
    445 that isn't appropriate for doxygenation, use an implementation block
    446 comment (sec. \ref{ImplBlockComments}) or single-line comment (sec. \ref{SingleLineComment})
    447 immediately \textit{before} the code. For example, details about the
    448 implementation of a type should go in in such an implementation block
    449 comment \textit{before} the start of the implementation, not in the
    450 doxygen comment.
     475that isn't appropriate for doxygenation, use a normal implementation
     476block comment (\S\ref{ImplBlockComments}) or single-line comment
     477(\S\ref{SingleLineComment}) immediately \textit{before} the code (as
     478exampled above). For example, details about the implementation of a
     479type should go in in such an implementation block comment
     480\textit{before} the start of the implementation, not in the doxygen
     481comment.
    451482
    452483%------------------------------------------------------------------------------
     
    747778expected) when the fall-through is between multiple case statements.
    748779
    749 Every \code{switch} statement should include a default case,
    750 which should come last. The \code{break} in the default case
    751 is redundant, but it prevents a fall-through error if later another
    752 \code{case} is later (and illegally) added after the default clause.
    753 
    754 When switching on an enumerated type, if all the elements of the
    755 type are included in the switch a default clause should still be
    756 added (not all compilers diagnose missing elements).  In this case,
    757 the action in the default clause should be to generate an error
    758 \and abort.
     780Every \code{switch} statement should include a default case, which
     781should come last. The \code{break} in the default case is redundant,
     782but it prevents a fall-through error if later another \code{case} is
     783later (and illegally) added after the default clause.
     784
     785When switching on an enumerated type, if all the elements of the type
     786are included in the switch a default clause should still be added (not
     787all compilers diagnose missing elements).  In this case, the action in
     788the default clause should be to generate an error and abort.
    759789
    760790\subsection{label Statements}
     
    14931523\item \code{--indent=spaces=4} - This option tells \code{astyle} to
    14941524  use 4 spaces per indent level.
    1495 
    1496 bibliographystyle{plain}
     1525\end{itemize}
     1526
     1527\bibliographystyle{plain}
    14971528\bibliography{panstarrs}
    14981529
Note: See TracChangeset for help on using the changeset viewer.