Boost logo

Boost :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-04-03 11:45:13

Doug Gregor wrote:
> On Apr 3, 2008, at 8:36 AM, Jeff Flinn wrote:
>> Giovanni Piero Deretta wrote:
>>> On Wed, Apr 2, 2008 at 11:37 PM, Stephen Nuchia
>>> <snuchia_at_[hidden]> wrote:
>>>>> Does #ifdef around #pragma omp indeed work? At least
>>>>> #define PARALLEL #pragma omp
>>>>> and using PARALLEL does not work.
>>>> I think the above may clash with either the definition or an
>>>> implementation of #pragma; I can't recall ever successfully using a
>>>> macro that expands to any directive. But that could be because I
>>>> haven't tried it in the last twenty years :-)
>>> I do not think that there is any way for a macro to expand to a
>>> directive.
>> You may want to pose that question to Paul Mensonides. He may have a
>> way
>> to get the desired effect with Boost::PP.
> C99 has _Pragma; otherwise, it isn't possible.

I haven't tried this, but how about the following(albeit not pretty):

#include pragma_omp_parallel
#include pragma_omp_for
for(int i = 1; i < size; ++i)
         x[i] = (y[i-1] + y[i+1])/2;

where the pragma_omp_* expand to file names whose contents contain
#pragma omp ***?

Just a thought.

Jeff Flinn

Boost list run by bdawes at, gregod at, cpdaniel at, john at