function pointer cast

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Hi, I have the following problem -

   

 

   

void dispfunc( signed long * dispval);

   

 

   

I want to call it with -

   

 

   

unsigned long testval = 0;

   

dispfunc( &testval );

   

 

   

Compiler, HiTech, warns illegal conversion bewteen pointer types. I would

   

have thought a signed and unsigned long ptr no different.

   

 

   

I tried various casts, cannot get it to work.

   

 

   

Regards, Dana.

0 Likes
2 Replies
Anonymous
Not applicable

 It compiles under Imagecraft compiler using this line:

   

dispfunc( (signed long *)&testval );

   

 

   

However I don't know if the generated code would be functionnal.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Thanks, compiles in HiTech, will know later today if it is working.

   

 

   

Regards, Dana.

0 Likes