[Qt-creator] indent preprocessor directives

Oswald Buddenhagen oswald.buddenhagen at nokia.com
Mon May 7 11:12:31 CEST 2012

On Mon, May 07, 2012 at 01:00:21PM +0400, ext Konstantin Tokarev wrote:
>     void foo()
>     {
> #ifdef foo
>         doSomething();
>   #ifdef bar
>         bar();
>   #else
>         notBar();
>   #endif
> #endif
>     }

    void foo()
#ifdef foo
#  ifdef bar
#  else
#  endif

works, too.
just see the hash in the first column as a different "syntax space"
(which it is), and then it makes perfect sense.

there is one exception: #pragma and some other directives are sometimes
passed through to the compiler, i.e., they are only "fake" preprocessor
directives and in fact _kind of_ belong into the proper code stream. one
could bikeshed this to no end ...

More information about the Qt-creator mailing list