stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: Inconsistent indentation in preprocessing directives
Date Mon, 23 Jun 2008 15:15:35 GMT
Eric Lemings wrote:
>  
> I was just looking at the indentation in the
> $TOPDIR/include/rw/_static_assert.h header.  Why are the defines within
> the `#ifndef _RWSTD_NO_STATIC_ASSERT' indented but the directives
> outside this #if/#else/#endif block are not?  Should they all be
> indented uniformly or not indented at all?

I agree it's inconsistent but I'm not sure there is much to
be gained from indenting the body of the top level blocks.
The purpose of the indentation is to aid readability and
Since virtually every header is always enclosed in a pair
of #ifdefs, indenting its contents wouldn't do anything to
help in this regard.

Martin

> 
> I realize this is not conventional but if we want to indent
> preprocessing directives, this file should look like this:
> 
> 	#ifndef _RWSTD_RW_STATIC_ASSERT_H_INCLUDED
> 	#  define _RWSTD_RW_STATIC_ASSERT_H_INCLUDED
> 
> 	#  include <rw/_defs.h>
> 
> 	...
> 
> 	#  ifndef _RWSTD_NO_STATIC_ASSERT
> 	#    define _RWSTD_STATIC_ASSERT(Cond)
> 	...
> 	#  else
> 	#    define _RWSTD_STATIC_ASSERT(Cond,Mesg) static_assert(Cond,
> Mesg)
> 	#  endif   // _RWSTD_NO_STATIC_ASSERT
> 
> 	#endif   // _RWSTD_RW_STATIC_ASSERT_H_INCLUDED
> 
> Otherwise, we shouldn't indent at all.
> 
> Thanks,
> Brad.


Mime
View raw message