User Tools

Site Tools

FRIDA C++ coding conventions

As all other implementation notes, this is subject to change during the real implementation work.



The code layout basically follows Kernigham & Ritchie style with 4 blanks indentation.

If in doubt, the command

indent -kr <file>

can be used on new code. However, this automatic layout tool shall not be used on existing code. It's layout is not free of inconsistencies, especially regarding blanks before and inside parentheses and blanks before/after * and & operators in function argument lists - but it's much better than any automatic solution.

Doxygen comments
//! <short description>, above a class|typedef|.. in the declaration (.h) file
/** <long description>, follows short description if one line is not enough
    ... */
<variable>  ///!< inline explanation of a variable

Variable names


class, namespace: upper case, camel case if appropriate

singleton class instance: the<Class>, e.g. theWorkspace

class member functions: lowercase. This is a change from Frida-pre-2

vectors and other non-elementary data: lowercase, or camel case starting with lowercase

pointer class: <Class>Ptr

pointer and smart pointer: no explicit p.., ..prt, or whatever. Look at the definition which is rarely far away.

Variable names

Should be more explicit than in earlier versions, as far as the generic frame is concerned.

In contrast, inner loops of numeric routines continue to be as concise as possible.


Consistent use of letters is primordial in cryptic programming. Beware however pedantic application of Hungarian convention.

  • c.. refers to a curve, where d.. refers to a data file
  • co.. is a coordinate, na.. its name, un.. its unit
  • f.. likely a file name. For file descriptors, use uppercase F
  • i.. likely an integer. Specifically: i, ii, … run over data points
  • j.. likely an integer. Specifically: j, jj, … run over spectra
  • k.. likely an integer. Specifically: k, kk, … run over files
  • n.. likely an integer. Typically: number of … Specifically so in ni, nj, nk
  • s.. or S.. refers to a scan (shall we change case from pre-2)
  • t.. (text) could be used for things converted to string (because s is take otherwise). But again, generally no Hungarian convention.

or curves) in WorkFile / DataFile / CurvFile

  • w.. refers to a workfile, usually through a smart pointer
  • A an abstract syntax tree
  • C.. class
  • D, DD double in value or channel
  • E, EE variance in value or channel
  • F_in, F_out are external file descriptors
  • I, II integer in value or channel
  • P fit parameters
  • T Tuple: within Spectrum, T[0] points to channel x, T[1] to y. nT is the internal representation of ni
  • V a vector which is a particular important member of a class; for instance the vector of slices

C++ idiom

const declarations

do_something( const int size_in ): “const” has no effect upon calling program (size_in won't be modified anyway, because it is passed by value to do_something). Therefore: write “const” only in the implementation, not in the declaration.