[fpc-pascal]Two questions on initialisation of variables
Aitor Santamaria Merino
aitor.sm at wanadoo.es
Wed Mar 20 19:27:09 CET 2002
Many of my programs start like this:
a, b,...: byte;
So I was wondering if these sentences are translated into MOV sentences,
or for the contrary, compiler has optimisations that initialise the data
segment with the appropriate values, saving valuable CPU clocks.
If the answer is no, is there a way to do this, other than
CONST v: type = value;
that seems to me "inelegant" for Pascal?
And the second is for initialisation of PChars. The examples of
reference guide, pag 29, seem to suggest that I don't need to New()
pchars. Is that right? I suppose this is only at initialisaton time.
Suppose that for some reason I had to new a PChar, I suppose that New()
would only allocate 1 byte, so I'd have to use GetMem, am I right??
GetMem (p, maxsize+1);
More information about the fpc-pascal