At 12:31 PM +0200 25/6/03, Adriaan van Os wrote:
In fact, casting does work in GPC in nearly all cases. Consider the following test program:
const k1: fourcharcode = 'wxyz'; k3 = 'klmn';
i:= word32( k1); writeln( 'i = ', i, ' (''', k1, ''')'); fourcharcode( i):= k2; writeln( 'i = ', i, ' (''', k2, ''')');
// i:= word32( k3); not allowed by GPC
The problem with this is that k1 is not actually a constant - it's really a variable that you can't modify which is quite significantly different no matter how similar the declaration might be. At least that is my understanding.
At 12:05 PM -0700 25/6/03, Gale Paeper wrote:
{$define UInt32(s) ((Ord (substr((s),1,1)) shl 24) or (Ord (substr((s),2,1)) shl 16) or (Ord (substr((s),3,1)) shl 8) or Ord (substr((s),4,1))}
At 12:34 AM -0700 26/6/03, Gale Paeper wrote:
ord(substr((s),1,1)[1])
This made me wonder if word32(substr(s,1,4)[1..4]) would work, but it does not either, the same as word32('abcd') doesn't work (as Frank says, there is an implicit endianness issue in that cast). Perhaps this could be allowed with flag akin to the $X?
Speaking of $X, is there a compiler directive that allows pointer arithmetic without all the other $X stuff (whatever that might be)? Currently I use
{$no-typed-address,X+,no-ignore-function-results}
but I worry about what other things like ignore-function-results $X+ ,might be "giving" me.
Thanks, Peter.