[vtk-developers] Coding Standards and the C preprocessor

Sean McBride sean at rogue-research.com
Tue Feb 26 10:18:47 EST 2008


Hi all,

What are the coding standards when it comes to the C preprocessor?
<http://www.vtk.org/Wiki/VTK_Coding_Standards> is silent on the issue.

Specifically, can we clarify:

1) indentation.  Should #if/#end blocks be indented?  Whitespace before
of after the #?  I've seen:

#ifdef foo
#pragma bar
#endif

#ifdef foo
#  pragma bar
#endif

#ifdef foo
  #pragma bar
#endif

even in the same file. (My vote is for the 3rd because most code editors
have a command to intent/outdent text, and that's how they do it.)

2) do we prefer "#ifdef FOO" or "#if defined (FOO)"

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtk-developers mailing list