Changeset 505
- Timestamp:
- Apr 22, 2004, 12:33:38 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/misc/codeConventions.tex (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/misc/codeConventions.tex
r501 r505 1 %%% $Id: codeConventions.tex,v 1.1 3 2004-04-22 20:30:32 eugene Exp $1 %%% $Id: codeConventions.tex,v 1.14 2004-04-22 22:33:38 price Exp $ 2 2 \documentclass[panstarrs]{panstarrs} 3 3 … … 137 137 138 138 For an example of a properly formatted program, see 139 Source File Example ( sec.\ref{SourceExample}).139 Source File Example (\S\ref{SourceExample}). 140 140 141 141 \subsection{Source Files} … … 233 233 234 234 When 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}.235 are not wrapped. If you are using the standard PSDC \LaTeX{} class 236 file \file{panstarrs.cls}, \CODE|\begin{verbatim} ... \end{verbatim}| 237 will do this for you. 238 238 239 239 \subsection{Wrapping Lines} … … 246 246 247 247 \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 } 253 253 \end{verbatim} 254 254 … … 393 393 describe. 394 394 395 See also Documentation Comments ( sec.\ref{DocComments}).395 See also Documentation Comments (\S\ref{DocComments}). 396 396 397 397 \subsubsection{Single-Line Comments} … … 400 400 Short comments can appear on a single line indented to the level of 401 401 the code that follows. If a comment can't be written in a single line, 402 it should follow the \ref{ImplBlockComments}block comment format.402 it should follow the block comment format (\S\ref{ImplBlockComments}). 403 403 404 404 \subsubsection{Trailing Comments} … … 440 440 \label{DocComments} 441 441 442 \tbd{Need references to Doxygen here.} 442 Doxygen\footnote{{\tt www.doxygen.org}} will be used to produce 443 documentation of the types, functions and variables without requiring 444 much extra effort for the programmer. Comments starting with 445 particular characters (``tags'') are used by Doxygen to identify the 446 relevant code to be documented. 447 448 Functions shall be tagged for Doxygenation by pre-pending them with a 449 block comment (\S\ref{ImplBlockComments}) which starts with a 450 \code{/**} instead of the usual \code{/*}. 451 452 Variables shall be tagged for Doxygenation by appending their 453 declaration with an end-of-line comment which starts with a 454 \code{///<} instead of the usual \code{//}. 455 456 An example of a function definition employing Doxygen-compatible 457 comments follows: 458 459 \begin{verbatim} 460 /** This is a really cool function. 461 * It does many really cool things. 462 */ 463 int 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} 443 473 444 474 If 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. 475 that isn't appropriate for doxygenation, use a normal implementation 476 block comment (\S\ref{ImplBlockComments}) or single-line comment 477 (\S\ref{SingleLineComment}) immediately \textit{before} the code (as 478 exampled above). For example, details about the implementation of a 479 type should go in in such an implementation block comment 480 \textit{before} the start of the implementation, not in the doxygen 481 comment. 451 482 452 483 %------------------------------------------------------------------------------ … … 747 778 expected) when the fall-through is between multiple case statements. 748 779 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. 780 Every \code{switch} statement should include a default case, which 781 should come last. The \code{break} in the default case is redundant, 782 but it prevents a fall-through error if later another \code{case} is 783 later (and illegally) added after the default clause. 784 785 When switching on an enumerated type, if all the elements of the type 786 are included in the switch a default clause should still be added (not 787 all compilers diagnose missing elements). In this case, the action in 788 the default clause should be to generate an error and abort. 759 789 760 790 \subsection{label Statements} … … 1493 1523 \item \code{--indent=spaces=4} - This option tells \code{astyle} to 1494 1524 use 4 spaces per indent level. 1495 1496 bibliographystyle{plain} 1525 \end{itemize} 1526 1527 \bibliographystyle{plain} 1497 1528 \bibliography{panstarrs} 1498 1529
Note:
See TracChangeset
for help on using the changeset viewer.
