Forum > Beginners
[SOLVED] Procedure parameter with no type?
CM630:
I have come accross the following routine:
procedure TSomething.AssignFrame(var Buf; Count: integer; bSometihing: boolean; ANr:cardinal; ATime:TDateTime);
I cannot find out what the type of Buf is. The code compiles and runs :o
Could it be a variant or could it be anything?
MarkMLl:
Treat it as an untyped pointer. See https://www.freepascal.org/docs-html/current/rtl/system/blockread.html as an example and note that in this situation you will invariably have a count parameter which has to be initialised to the size of the buffer.
MarkMLl
tetrastes:
https://www.freepascal.org/docs-html/current/ref/refsu70.html#x186-21000014.4.7
CM630:
Thanks, I will try to figure these documents out.
Edit: I have handled the case successfully.
Joanna from IRC:
I used to do things like that so that I could use one procedure for different types of parameters. Are you able to see the inner workings of the procedure with untyped parameter?
I remember having code to test what parameter was and typecast it inside of the procedure...
Navigation
[0] Message Index
[#] Next page