[Qt-creator] indent preprocessor directives

Nikos Chantziaras realnc at gmail.com
Sat May 5 09:32:12 CEST 2012


Uhm, please read the thread.  There is no problem with indenting 
preprocessor directives.  *All* preprocessors will accept this since 
ANSI-C demands it.

I wonder where this myth that you can't indent originated from.  It 
seems to be quite popular :-/

On 05/05/12 06:07, Jonathan S. Shapiro wrote:
> Many preprocessors will not accept the input you propose. The directive
>   can be indented, but many (perhaps most) preprocessors still expect
> the '#' to appear in column 1.
>
> Jonathan
>
> On Fri, May 4, 2012 at 6:33 PM, Mohammad Mirzadeh <mirzadeh at gmail.com
> <mailto:mirzadeh at gmail.com>> wrote:
>
>     Well in the example I wrote I need to have
>
>       int  main()
>
>       {
>
>            #pragma  omp  parallel
>
>            {
>
>                cout  <<  "Hello world from thread #"  <<  omp_get_thread_num()    <<    endl;
>
>            }
>
>            return  0;
>
>       }
>
>
>
>
>     instead of
>
>       int  main()
>
>       {
>
>       #pragma  omp  parallel
>
>
>
>
>            {
>
>                cout  <<  "Hello world from thread #"  <<  omp_get_thread_num()    <<    endl;
>
>
>
>
>            }
>
>            return  0;
>
>
>
>
>       }
>
>
>     This is OK for this example, but for longer ones with couple of
>     nested code blocks, its gets annoying since # starts at column 1 but
>     the code blocks are potentially anywhere
>
>
>
>
>
>
>
>     On Fri, May 4, 2012 at 1:16 PM, Nikos Chantziaras <realnc at gmail.com
>     <mailto:realnc at gmail.com>> wrote:
>
>         On 04/05/12 23:02, Atlant Schmidt wrote:
>          > Nikos, et al.:
>          >
>          >> Indenting preprocessor directives is perfectly acceptable by
>         the standard.
>          >
>          >    Pre-ANSI C, when many of us learned to type, that wasn't
>          >    the case; preprocessor directives had to start in column 1.
>          >    But ANSI C has been around for a long time now... ;-)
>
>         Since this is C++, we don't even need to care. You can't write Qt
>         programs with pre-ANSI C compilers to begin with :-)
>
>         _______________________________________________
>         Qt-creator mailing list
>         Qt-creator at qt-project.org <mailto:Qt-creator at qt-project.org>
>         http://lists.qt-project.org/mailman/listinfo/qt-creator
>
>
>
>     _______________________________________________
>     Qt-creator mailing list
>     Qt-creator at qt-project.org <mailto:Qt-creator at qt-project.org>
>     http://lists.qt-project.org/mailman/listinfo/qt-creator
>
>
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator





More information about the Qt-creator mailing list