break

General OpenMP discussion

break

Postby chameleon » Mon Jan 23, 2012 6:53 pm

Newbie alert.

If break is not allowed, how the following code will be parallel processed?
Code: Select all
int z = 0;
for (; z != size; z++)
    if (array[z] == 1) break;
if (z != size) do_things_on(z);
Consider that:
  • Only one element is 1
  • Many elements are 1
chameleon
 
Posts: 8
Joined: Mon Jan 23, 2012 6:37 pm

Re: break

Postby ftinetti » Tue Jan 24, 2012 4:44 am

Hi,

Well, I think there is a range of possibilities for non conforming code, from a compiler warning, compiler error and, always, unexpected results.

HTH.
ftinetti
 
Posts: 582
Joined: Wed Feb 10, 2010 2:44 pm


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 12 guests