[Qt-creator] indent preprocessor directives

Jonathan S. Shapiro shap at eros-os.org
Sat May 5 05:07:37 CEST 2012


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>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>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
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20120504/fe658921/attachment.html>


More information about the Qt-creator mailing list