I know that #define
s, etc. are normally never indented. Why?
I'm working in some code at the moment which has a horrible mixture of #define
s, #ifdef
s, #else
s, #endif
s, etc. All these often mixed in with normal C code. The non-indenting of the #define
s makes them hard to read. And the mixture of indented code with non-indented #define
s is a nightmare.
What is the benefit of not indenting #define
s? Does it make me a bad person if I indent them? Isn't this much nicer?
#ifdef SDCC
#if DEBUGGING == 1
#if defined (pic18f2480)
#define FLASH_MEMORY_END 0x3DC0
#elif defined (pic18f2580)
#define FLASH_MEMORY_END 0x7DC0
#else
#error "Can't set up flash memory end!"
#endif
#else
#if defined (pic18f2480)
#define FLASH_MEMORY_END 0x4000
#elif defined (pic18f2580)
#define FLASH_MEMORY_END 0x8000
#else
#error "Can't set up flash memory end!"
#endif
#endif
#else
#if DEBUGGING == 1
#define FLASH_MEMORY_END 0x7DC0
#else
#define FLASH_MEMORY_END 0x8000
#endif
#endif
Pre-ANSI C preprocessor did not allow for space between the start of a line and the "#" character; the leading "#" had to always be placed in the first column.
Pre-ANSI C compilers are non-existent these days. Use which ever style (space before "#" or space between "#" and the identifier) you prefer.