On Fri, 27 Nov 2009, Mindaugas Kavaliauskas wrote:

Hi,

> I've also looked at SafeArrayToArray() function from xHarbour
> win32ole.prg, but after 10 seconds I've understood it's better not
> to look at this, because I can start to replicate it. So, that's the
> reason why hb_oleSafeArrayToItem() is so short and simple :)

Yes it's really nice though it probably can be even simpler without
recursion.
This code allocates memory for index array using hb_xgrab() and needs
recursion only for allocating dynamically lFrom and lTo on C stack.
It means that it should be enough to allocate memory 3 times bigger
for lIndex[es], lFrom[s] and lTo[s] and convert array in two nested
loops.
Hmm, it will be shorter and probably a little bit faster but I cannot
say if such version is more readable. It's necessary to compare final
code to answer. Maybe in some spare time ;-)

BTW in MS documentation dimensions are stored in 'unsigned int' instead
of 'int'. Maybe we should follow it?

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to