writing to dynamic array via formal parameter; what is the right way

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

writing to dynamic array via formal parameter; what is the right way

Пётр Косаревский
I use something like

var a: array of byte;
setlength(a,TheSize);
blockwrite(afile,a[0],TheSize);

Of course, if it is possible that TheSize=0, I have to write "if TheSize>0 then blockwrite(...);"

Is this the intended way? (Ok, that's not a big overhead, but it seems strange to me.)

What is the intended way (if it's somewhat different)?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal