[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
indenting preprocessor conditionals?
From: |
John W. Eaton |
Subject: |
indenting preprocessor conditionals? |
Date: |
Tue, 02 Feb 2016 14:51:05 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 |
Are there any preferences for indenting preprocessor conditionals? If
there are no objections, I'd like to start writing something like
#if defined (HAVE_SUITESPARSE_AMD_H)
# include <suitesparse/amd.h>
#elif defined (HAVE_UFSPARSE_AMD_H)
# include <ufsparse/amd.h>
#elif defined (HAVE_AMD_AMD_H)
# include <amd/amd.h>
#elif defined (HAVE_AMD_H)
# include <amd.h>
#endif
or
#if defined (HAVE_CXSPARSE)
# if defined (ENABLE_64)
# define CXSPARSE_DNAME(name) cs_dl ## name
# define CXSPARSE_ZNAME(name) cs_cl ## name
# else
# define CXSPARSE_DNAME(name) cs_di ## name
# define CXSPARSE_ZNAME(name) cs_ci ## name
# endif
#endif
instead of smashing everything over on the left margin.
Indentation increments of one space seem common for this kind of thing,
but maybe we should go with two since that's generally the amount we use
in other code in Octave.
I've also seen
#if defined (HAVE_CXSPARSE)
#if defined (ENABLE_64)
#define CXSPARSE_DNAME(name) cs_dl ## name
#define CXSPARSE_ZNAME(name) cs_cl ## name
#else
#define CXSPARSE_DNAME(name) cs_di ## name
#define CXSPARSE_ZNAME(name) cs_ci ## name
#endif
#endif
though I think I prefer to leave the '#' character in the first column.
Note that I would NOT apply the indentation to anything inside the
multiple inclusion guards, so we would still have
#if !defined (octave_foo_h)
#define octave_foo_h 1
#include <iostream>
...
#endif
Comments?
jwe
- indenting preprocessor conditionals?,
John W. Eaton <=