[fpc-pascal] Common OpenMP syntax?

Vinzent Höfler JeLlyFish.software at gmx.net
Fri Jul 21 01:10:32 CEST 2006


Marc Weustink wrote:
> Steve Williams wrote:
>>
>> Using some of the documented examples in the v2.5 spec:
>>
>> Example A.1.1:
>> procedure a1(n: Integer; a: PSingleArray; b: PSingleArray);
>> var
>>  i: Integer;
>> begin
>>  {$omp parallel for}
>>  for i := 1 to n - 1 do
>>    b^[i] := (a^[i] + a^[i - 1]) / 2.0;
>> end;
> 
> Brrr.... using local defines look not native to the language.

"Not native". Well, I would have prefered the term "darn ugly". :)

> procedure a1(n: Integer; a: PSingleArray; b: PSingleArray);
> var
>  i: Integer;
> begin
>  for i := 1 to n - 1 do
>  parallel
>    b^[i] := (a^[i] + a^[i - 1]) / 2.0;
>  end;
> end;

Yes, this idea looks *much* nicer. And much more Pascalish.


Vinzent.




More information about the fpc-pascal mailing list