Page 1 of 1

C : #pragma pointer_size ignored???

Posted: Mon Dec 04, 2023 4:51 am
by joukj
Hi All

I get the following:

rumba-jj) cc/vers
VSI C x86-64 X7.4-843 (GEM 50XB9) on OpenVMS x86_64 V9.2-1
rumba-jj) ty test.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
#pragma pointer_size 64
int* i = (int*) malloc( 80 );

#pragma pointer_size 32
int* i2 = (int*) malloc( 80 );
printf( "%u %u" , i , i2 );
return 0;
}
4-DEC-2023 10:47:22
rumba-jj) cc/point=32 test.c
rumba-jj) link test
rumba-jj) run test
27984 28096
rumba-jj) cc/point=64 test.c
rumba-jj) link test
rumba-jj) run test
2147508256 2147508368


Looks like the #pragma pointer_size is ignored. I get the same on IA64. What do I do wrong?

Jouk

Re: C : #pragma pointer_size ignored???

Posted: Mon Dec 04, 2023 5:16 am
by pustovetov
joukj wrote:
Mon Dec 04, 2023 4:51 am
Hi All

I get the following:

rumba-jj) cc/vers
VSI C x86-64 X7.4-843 (GEM 50XB9) on OpenVMS x86_64 V9.2-1
rumba-jj) ty test.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
#pragma pointer_size 64
int* i = (int*) malloc( 80 );

#pragma pointer_size 32
int* i2 = (int*) malloc( 80 );
printf( "%u %u" , i , i2 );
return 0;
}

Looks like the #pragma pointer_size is ignored. I get the same on IA64. What do I do wrong?
Try this:

Code: Select all

#include <stdio.h>
#include <stdlib.h>
int main()
{
#pragma pointer_size 64
   int* i = _malloc64( 80 );
   
#pragma pointer_size 32
   int* i2 = _malloc32( 80 );
   printf( "%u %u" , i , i2 );
   return 0;
}
This pragma changes the type of pointers but does not cause the correct function to be substituted.

Re: C : #pragma pointer_size ignored???

Posted: Mon Dec 04, 2023 5:47 am
by joukj
Thanks, that helps