[fpc-devel] Redefine FillChar() to use out parameter instead

Graeme Geldenhuys graeme at mastermaths.co.za
Thu Nov 19 10:28:42 CET 2009


Florian Klaempfl wrote:
> 
>> I see many use-cases for out parameters
> 
> You mean for VAROUT parameters :)?


I search the latest FP Language Reference document, and there is no
mention of 'varout'. I also tried to use varout in a procedure as
follows - which gave a compiler error with FPC 2.4.0-rc1

 procedure dcpFillChar(varout x; count: SizeInt; Value: Byte); overload;

vs

 procedure dcpFillChar(out x; count: SizeInt; Value: Byte); overload;


First one is not compilable, but the second one is. So no, I don't
understand your comment about 'varout'? Please explain more.

Where I use 'out' parameters often is in the case where a function needs
to return more than one value. For example the standard return value of
the function is Boolean to say if the function as a whole succeeded or
not. The out parameters are actual values that will be initialized and
what I will work with after the function call.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-devel mailing list