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.
More than 100 posts just because a broken assumption about how to use pointers...
About unsure/confused/insecure compilers. The developers of the compiler knows that some translation rules are less likely and that there may be a good idea to warn the user.
However, the compiler is most definitely without any feelings. And I'm pretty sure that the developers of the compiler are reasonably sure about what they do, and what they want their compiler to do.
It is all probabilities and experience. Compilers are normally designed (and the language it handles) by knowledgeable people. Knowledge normally implies experience. Experience tells that some constructs are seldom intended - such as the traditional if (a = b) ... - and it is then a good idea to add a warning. But the compiler is not unsure. And the compiler developers are not unsure. They are on the other hand suspecting that the end user is unsure - or just clueless...
it IS unsure about the users intention.
Round and round and round we go!
Have you tried your unprototyped function mismatched arguments example yet?
Erik
I said Thus the compiler, while being "content with its decision" (it has done what the documentation states it will)
But of course you've snipped the crucial part of your post. Here's the rest of the sentence:
does declare "I am unsure" i.e. issues a warning.
Your 'adjustment' of quotes definitely is "as the corrupt administration attempts to rewrite history".
Oddly enough, the quote you give was not a response to one of Eriks posts.
Indeed, which is why I'm amazed that he went on to adopt and defend it as follows:
Often, a compiler will try to figure out what you ment and instead of an error issue a warning, which, in a way means "the compiler was unsure how to handle it.".
That is a statement to print and put on the wall. The next time I get a compiler error, I will complain about insecure compilers
I said Thus the compiler, while being "content with its decision" (it has done what the documentation states it will) That comment of yours definitely is "as the devil reads the bible"
Yes:
ridicule?
That is a statement to print and put on the wall. The next time I get a compiler error, I will complain about insecure compilers. That is almost as funny as saying that the car stood still when the tree suddenly decided to run into it.
Just noticed an update to the C51 compiler, bringing it up to 8.20.
Hope it reports the same warnings, else the OP will start all over again!?
"it leaves the compiler 'unsure if this is what you want'".
or
and the result is perfectly well-defined - but there is reason to doubt that it may not actually have been the programmer's intention.
Maybe he's (finally) understood?
I haven't seen any "Hey, thanks guys for explaining it to me." messages yet.
He may have just left to try his luck in a different forum.
And the even better method is of course to learn how pointer indirection works. Then the Address field could be changed from uint to a pointer of the proper type - and no typecast would be needed.
Ok, I'll go along with the suspect.
That said, I always feel safer by treating warnings as an indication that the code/project needs modifying; if only to examine the suspect line and override the compiler's message.
In other words, I treat warnings as errors.
Anyway, the OP seems to have given up debating the point ... Maybe he's (finally) understood?
No, it's not actually wrong - it's just suspect - which is why it only gets a warning, not an error.
"The best method of removing the error is to correct the incorrect code!"
There isn't an error to remove - but, as has already been explained, the suspicion could be removed by using an explicit cast!
"I can see no wrong use of the pointers."
You're code is wrong.
The best method of removing the error is to correct the incorrect code!
View all questions in Keil forum