[fpc-pascal] Getting fast output

Marco van de Voort marcov at stack.nl
Tue Jul 22 11:23:01 CEST 2008


> Peter Vreman wrote:
> > 
> >  http://www.freepascal.org/docs-html/rtl/system/settextbuf.html
> > http://www.freepascal.org/docs-html/rtl/system/settextbuf.html 
> > 
> Oh, yeah! I forgot to mention this. But declaring the buffer will eat spaces
> ,for instance:
> ...
> var
>   Buf: array [0..65535] of Byte;
> ...
> will add 64k to the executable because it's allocated on the stack.

Huh?

A filebuffer variable must be available always, so it is a global variable.
Global variables are in the datasegment. The datasegment is traditionally
divided into two parts, an initialized part (which goes into the binary) and
the uninitialized (which doesn't go in the binary).

Since the above variable is not initialized, it will not go into the binary.

Unless your platform is somehow different, but even then you can allocate it
on the heap.



More information about the fpc-pascal mailing list