This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compiling differences between C51 v7.03 and v8.06

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.

Parents
  • I repeat for the xth time that I absolutely KNOW what a pointer is and I also KNOW the terminology,

    Repeating it doesn't help when your explanations indicate the opposite.

    if I read a value out of a struct via a struct pointer and this value is an uint value and I put this value to another pointer, also of type uint, I simply expect this procedure to be correct.

    A pointer is not uint or whatever. A pointer is a pointer
    Also, you haven't even shown your definition of uint yet. It could be anything.

    A pointer is not an integer value to the compiler. It cannot and must not be, since it needs to be treated completely differently than an integer value in operations. Going back to my earlier example (did you read it, and think about it?):

    unsigned int some_int = 0;
    unsigned int *some_ptr = 0;
    
    some_int++;
    some_ptr++;
    

    What is the value of the two variables after the increment ? The correct answer should also explain why pointers and unsigned integers are two completely different data types. That they take up the same amount of memory is pure coincidence.

    In my understanding and I guess in everyone else too, this means that I was trying to convert something that's not a pointer (a normal variable, for exmple) to a pointer.

    What is a "normal variable" ? An integer is "normal", and not a pointer, and you are trying to convert it implicitly to a pointer. The compiler is totally correct when it issues a warning. If you want the warning to disappear, you need to do an explicit type cast (which you said you did, but you did not post the code you used, so we cannot tell if it is correct).

    You need to grab a C textbook and read up on 1) pointers and b) operators that work on pointers, especially the "member reference from pointer" operator "->".

    some_struct_ptr->some_int_member
    

    evaluates to the value of some_int_member, not to its address. If you want the address, you need to use

    &some_struct_ptr->some_int_member
    

Reply
  • I repeat for the xth time that I absolutely KNOW what a pointer is and I also KNOW the terminology,

    Repeating it doesn't help when your explanations indicate the opposite.

    if I read a value out of a struct via a struct pointer and this value is an uint value and I put this value to another pointer, also of type uint, I simply expect this procedure to be correct.

    A pointer is not uint or whatever. A pointer is a pointer
    Also, you haven't even shown your definition of uint yet. It could be anything.

    A pointer is not an integer value to the compiler. It cannot and must not be, since it needs to be treated completely differently than an integer value in operations. Going back to my earlier example (did you read it, and think about it?):

    unsigned int some_int = 0;
    unsigned int *some_ptr = 0;
    
    some_int++;
    some_ptr++;
    

    What is the value of the two variables after the increment ? The correct answer should also explain why pointers and unsigned integers are two completely different data types. That they take up the same amount of memory is pure coincidence.

    In my understanding and I guess in everyone else too, this means that I was trying to convert something that's not a pointer (a normal variable, for exmple) to a pointer.

    What is a "normal variable" ? An integer is "normal", and not a pointer, and you are trying to convert it implicitly to a pointer. The compiler is totally correct when it issues a warning. If you want the warning to disappear, you need to do an explicit type cast (which you said you did, but you did not post the code you used, so we cannot tell if it is correct).

    You need to grab a C textbook and read up on 1) pointers and b) operators that work on pointers, especially the "member reference from pointer" operator "->".

    some_struct_ptr->some_int_member
    

    evaluates to the value of some_int_member, not to its address. If you want the address, you need to use

    &some_struct_ptr->some_int_member
    

Children
No data