[Qt-creator] indent preprocessor directives

Konstantin Tokarev annulen at yandex.ru
Mon May 7 11:16:47 CEST 2012



07.05.2012, 13:12, "Oswald Buddenhagen" <oswald.buddenhagen at nokia.com>:
> 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
>         doSomething();
> #  ifdef bar
>         bar();
> #  else
>         notBar();
> #  endif
> #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.

I think that good code should be readable without syntax highlighting,
and for me it's easier to identify #directive in code than hash in first
column and directive somewhere in the middle of line between C++
code. Your mileage may vary though.

-- 
Regards,
Konstantin



More information about the Qt-creator mailing list