[cfe-dev] OpenMP support in CLANG: A proposal

Olaf Krzikalla Olaf.Krzikalla at tu-dresden.de
Wed Nov 7 08:02:23 PST 2012


Am 07.11.2012 16:00, schrieb Mahesha HS:
> Regarding your
> question about *scope*,  I meant following example. In OpenMP
> annotated C++ source,  following code snippet is valid. In this
> particular example, I meant about handling the scope of variable
> "VarA" .
>
> =======================================
> #pragma omp parallel if (int VarA = 2)
> {
>     // parallel region
> }
>
> VarA = 3;
>
> #pragma omp parallel if (VarA = 2)
> {
>     // parallel region
> }
> ========================================

This is not backed up by the OpenMP standard. The Grammar mentions only

if (expression)

And the C++ standard has its own grammar rules for expressions in 
conditions in order to make declarations possible.
Of course if the above extension is consensus among all other compilers 
then we have to adopt to it. However I doubt it. It begs for trouble if 
you e.g. compile with OpenMP disabled. Thus, if this is just an gcc 
extension I'd just leave it out.

Best Olaf




More information about the cfe-dev mailing list