[fpc-pascal]sizeof returns wrong size?
James_Wilson at i2.com
James_Wilson at i2.com
Wed Mar 27 17:31:06 CET 2002
> Before you call the procedure, it should be possible to use "sizeof".
> It's just impossible, because it's untyped IN the procedure.
> Try calling it like this:
> Win32Write (Col, Row, SourceData, sizeof(SourceData));
> if you finish the array with a null value you can know when is finish and
so the length
> of it. but as jonas said it'll be better to pass an argument to the
function with the length
> of the buffer:
> Procedure Win32Write (Col,Row : byte; "length :dword;" var SourceData);
Getting the length before calling the procedure was a PITA for the most
part -- and sizeof still didn't return the correct values even, when used
on the calling side of the code -- but the logic behind these two
suggestions made a lot of sense. After some recoding I was able to get
things to function a bit better. Thanks.
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20020327/93ad8a57/attachment.html>
More information about the fpc-pascal
mailing list