Hello!
I have uVision that compiles fine with the C51 v7.03 compiler and the related package, but not complete with the 8.06. I used two different Keil installations. All files are in the same folder.
In the 8.06 I get linker errors like "object does not fit in to pdata page" and "0080H". This looks like the compiler was thinking the PDATA was only 128 bytes, but it is set to 256 bytes in the startup.a51. Any clue what's different in the newer Keil package?
Also there is a warning in 8.06 (which does not show in 7.03) "converting non-pointer to pointer" on this
ptr_xdata = sPtr_obj->Adresse;
while the vars are set like this:
uchar uc_set_obj( uchar pdata *ptr_Set) { uchar i; uchar xdata *ptr_xdata; struct stOBJADR code *sPtr_obj; sPtr_obj=&Obj[*ptr_Set]; . . . ptr_xdata = sPtr_obj->Adresse; }
The struct stOBJADR has a member "uint Adresse;"
I can see no wrong use of the pointers. I just want to be sure that the warning does not affect the code to not work correctly.
And how do you call this value?
Value of the dereferenced pointer.
I still don't get why setting a pointer of type uint to an address given by a value of type uint is conversion or why it is called conversion.
Because "pointer to uint" and "uint" are two completely different types for the compiler, that need to be treated completely differently in a number of cases.
Okay, I'll repeat my little quiz for the third time:
unsigned int some_int = 0; unsigned int *some_int_ptr = 0; some_int++; some_int_ptr++;
What is the value of some_int after this snippet ? (that's easy, right) ?
What's the value of some_int_ptr after this snippet ? (or - is it even possible to answer this question?)
uint some_var; struct stObJ{ uint address; uchar object_nr; }; struct stObj *stPtr_Obj; stPtr_Obj->address = &some_var; // st_ptr_Obj->address is a uint, // &some_var is a pointer to uint. TYPE CONVERSION. // (Yes, believe me, it's really really really true) ptr_xdata = stPtr_Obj->address; // ptr_xdata is a pointer to something, // stPtr_Obj->address is a uint. // ANOTHER TYPE CONVERSION.
like I was writing it all the time and that's why I'm not very delighted (confusion has gone since I managed to figure out what the compilers considers as conversion) about the compiler warning.
Believe it or not: The compiler is correct. Your problems with understand this fact and the reasons for it stem from a) misconceptions about the data type "pointer to something" and b) very big misconceptions about what the "member reference from pointer" operator "->" does. "->" does _not_ return an address, it returns a value. Please please please believe it, it's true.