On Wednesday 26 July 2006 10:05, Andreas Berger wrote: > 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;
Actually no. I thought about it, but I didn't get through all that stuff yesterday evening or else I would have updated the WiKi already. The problem I see is that the parallel directive has more meanings (basically it is the main directive). For that reason, I wouldn't want to put in on the callee, but rather on the caller. I think it would also be easier for the compiler then to detect alls those parallel regions. Let's see. Anyway, there was already more response I would have expected after the days of silence. :) Vinzent. _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
