Steve Williams wrote:
Michael
Van Canneyt wrote:
Which is why I think that it's better to have
them as local functions,
instead of having to introduce a lot of new functions.
Local functions are very pascal-ish. C doesn't have it, which is why
they can't use it.
Let's use the language features to their full extent.
*procedure* SubTask(*var* x : *array of* Float);
*var*
/// Variables declared here have /|*private*|/ context./
iam : Integer;
nt : Integer;
ipoints : Integer;
*parallel*
iam := OMP.Get_Thread_Num; /// OMP library calls./
nt := OMP.Get_Num_Threads;
ipoints := Length (x) *div* nt; /// size of partition/
istart := iam * ipoints; /// starting array index/
*if* iam = Pred (nt) *then*
ipoints := Length (x) - istart; /// last thread may do more/
SubDomain (x, istart, ipoints);
*end*;
Wouldn't it be better to write it like this:
procedure SubTask(var x: array of Float); parallel;
var
...
begin
...
end;
|
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal