[fpc-pascal] getmem

Luis Fernando Del Aguila Mejía luis3000 at ec-red.com
Wed May 25 19:58:53 CEST 2011


El 25/05/2011 01:35 a.m., fpc-pascal-request at lists.freepascal.org escribió:
> Question out of curiosity:
> Is there a reason why you allocate an array "by hand"?

Yes, getmem return NIL, when no more memory is available.
SetLength, no return NIL, It is work with Exceptions.

My intention was whether it could be done without using dynamic arrays 
and Exceptions.
But two more questions:

1) At this program:

Var A:Ansistring;
Begin
  A:='Hi';
End.

The literal String is at Data area.
Is the A variable points to Data Segment. ?

2) My computer is little endian. (intel)
When I do this:

a: = $ ABFE5689 / / Little endian $ 8956FEAB, it is ok
Writeln (Hi (a)) / / Show $ ABFE, it is ok
Writeln (Lo (a)) / / Show $ 5689, it is ok

In a Big Endian computer. What shows Hi and Lo?

thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110525/e2df994b/attachment.html>


More information about the fpc-pascal mailing list