Menu

#61 - Cannot Typecast from (long) to (unsigned char *) ?

closed-rejected
nobody
None
5
2007-05-18
2007-05-18
Anonymous
No

Hello,

I just updated from SDCC 1.2 to 2.6,
because of the unreliability in compilations, such as:
if() statements encompassing the rest of while() loops,
and vars needing to be redundantly typecast,
etc.

But now I am getting a compilation abort because of
a typecast from (long)or(unsigned long) to (unsigned char *).
How do I work around this ?

JC.

---------

Code:
int s_printfint( char* buf , char* format , unsigned long num )
{
unsigned char * ptr;
ptr = (unsigned char *)num; // -typecast Error ?!
}

Compile:
J:\_MICROS\8051\DS5000\_EXAMPLES\UART\MY_UART.C>call H:\Micros\8051\_SDCC260\sdcc\bin\sdcc.exe -L H:\Micros\8051\_SDCC\lib\large -I H:\Micros\8051\_SDCC\includ
e --xram-loc 0x6000 uart.c

Error:
uart.c:535: error 127: non-pointer type cast to generic pointer from type 'long-int' to type 'unsigned-char generic* '
uart.c:676: error 103: code not generated for 's_printfint' due to previous errors
-:0: error 103: code not generated for 'main' due to previous errors

---------

Discussion

  • Maarten Brock

    Maarten Brock - 2007-05-18

    Logged In: YES
    user_id=888171
    Originator: NO

    I never heard of SDCC 1.2.

    And that's no bug. So I moved it to support requests.

    Which memory type is this long integer supposed to be?

    Shouldn't you tell the compiler the memory model if you link with a non-default memory model library?

    And now my biggest guess: will you be able to find this because you did not log in? Only if you wrote down the tracker id or if you search really good. Or will we just see another double post in no-time?

    Anyway, Good luck,
    Maarten

     
  • Maarten Brock

    Maarten Brock - 2007-05-18
    • status: open --> closed-rejected
     

Log in to post a comment.