[Info-vax] DEC C 64/32 bit pointer conversion question
John E. Malmberg
wb8tyw at qsl.net_work
Mon Sep 16 19:18:49 EDT 2019
On 9/13/2019 3:37 PM, Arne Vajhøj wrote:
> Can you provide a two module example showing the problem?
I found out what I was doing wrong.
And I was looking at the wrong value in the debugger. The value was
something like 80000020
A 32 bit pointer on VMS is actually only 31 bits, not 32 bits.
Adjusting the code to handle that case results in:
#pragma pointer_size save
#pragma pointer_size 64
typedef char * char_ptr64;
#pragma pointer_size 32
typedef char * char_ptr32;
#pragma pointer_size restore
static void
convert32 (const char * str, char_ptr32 * str32)
{
int len32;
char_ptr32 new_str32;
/* Only copy the pointer if it is larger than 32 bits */
if (((unsigned long int)str & 0xFFFFFFFF80000000) == 0)
{
*str32 = (char_ptr32)((unsigned)str & 0x7FFFFFFF);
}
}
Regards,
-John
More information about the Info-vax
mailing list