Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Misc > size problems w...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 714 of 792
Post > Topic >>

size problems when casting integer onto set in gpc

by "southwesthustla" <fdkelly@[EMAIL PROTECTED] > Jan 26, 2007 at 05:39 AM

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?

Thanks

Frank




 7 Posts in Topic:
size problems when casting integer onto set in gpc
"southwesthustla&quo  2007-01-26 05:39:02 
Re: size problems when casting integer onto set in gpc
"southwesthustla&quo  2007-01-26 05:43:12 
Re: size problems when casting integer onto set in gpc
Jonas Maebe <Jonas.Mae  2007-01-26 14:44:02 
Re: size problems when casting integer onto set in gpc
Waldek Hebisch <hebisc  2007-01-26 14:57:43 
Re: size problems when casting integer onto set in gpc
"southwesthustla&quo  2007-01-30 07:46:34 
Re: size problems when casting integer onto set in gpc
Waldek Hebisch <hebisc  2007-01-30 18:16:00 
Re: size problems when casting integer onto set in gpc
"southwesthustla&quo  2007-01-31 06:13:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 0:43:13 CDT 2008.