southwesthustla <fdkelly@[EMAIL PROTECTED]
> wrote:
> Hello, Pascal gurus.
> I am trying to compile some legacy Pascal code with the GNU compiler,
> gpc in Windows which is obviously 32-bit. The original code was used on
> a Motorola 68000 processor (16-bit).
>
> I note that in (MinGW) gpc a 'set' is internally a multiple of 4 bytes
> long. I would like to cast a 16-bit unsigned integer (i.e. size of 2
> bytes) onto a 16-element set. This should be possible, if the set was
> allowed to be 2 bytes long also. Unfortunately gpc sets it to four
> bytes. So I get the message "warning: cast to type of different size"
> on compilation. I can resize an integer to 4 bytes using the
> 'attribute' command I realise. However, can I be sure that the
> integer's bits map to the correct set elements?
>
> Furthermore, the intention of my code was to cast this 7 by 2 byte set
> array (then 14 bytes) onto a 112 element set (which occupied 14 bytes
> also). Unfortunately compiling the code with gpc these now occupy 28
> bytes and 14 bytes respectively. So on compilation I get a second
> warning followed by a rather unceremonious crash when I try to execute.
>
> Presumably gpc has these limitations on set size because of the 32-bit
> architecture. Is there any way around it?
>
Currently set size in GPC is a multiple of size of MedInt (32 bits
on 32 bit machines, 64 bits on 64 bit machines). This is likely
to change but only for small sets (to save space). There is no
user accessible way to change size of a set (you would have to
modify the compiler).
I think you should write what you really want to do. If you want
copy content of a set to an array of 16-bit integers (or back) you
can use Move builtin routine. Concerning crash: accessing memory
beyond allocated size is likely to cause crash (in newer gpc versions
most such cases should be caught by range checking).
--
Waldek Hebisch
hebisch@[EMAIL PROTECTED]


|