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.
Well, kinda flaming me for using the wrong terms (if millions of people think the same way, it's not necessarily correct, as the history shows) is actually not the help I hoped for. I actually found the only one solution that helped getting rid of this warning:
ptr_xdata = (uchar *) stPtr_Obj->Adresse;
The cast is the solution. It was hidden amongst the many text that was written telling me what to DO NOT, instead of telling me what to DO.
Thanks anyway, guys. I know you only did your best and I also know that you are so much into programming (and perhaps doing nothing else in your job) that you are unable to even consider a different terminology for the same understanding (I always knew what pointers are, I just call it differently). I guess the biggest problem with this compiler warning was the little word "conversion". Because when it says "conversion: non-pointer to pointer" for the line of code above, then it's clear for me that ptr_xdata is meant. And this pointer is not converted, it's indirectly set to a variable. So the whole confusion just started by a silly english warning...
No, you have never been flamed for using the wrong terminology.
It is a border case that you have been flamed: But for completely refusing to accept that your terminology is incorrect.
if millions of people think the same way, it's not necessarily correct, as the history shows
Not applicable, since we are not talking about what millions of people think, but what a few number of people have defined.
No, the cast was not hidden away somewhere. It has been discussed a number of times in a number of posts, but you have totally failed to understand our posts, since you have been using a home-grown vocabulary.
We have also discussed - multiple times - why the cast would not be needed at all, i.e. why the Adresse field shouldn't have been an integer but a pointer in the first place.
1000ml of water is the same as 1 litre of water. Still, you do a conversion of units when switching between the two. In the same way, the compiler has to do a conversion of data types (and in some cases a conversion of the binary representation).
"The cast is the solution. It was hidden amongst the many text that was written telling me what to DO NOT, instead of telling me what to DO."
No, it was not in the least bit hidden - I stated it very clearly and explicitly in the very first reply in this thread - 5-Feb-2008 06:36:
"As usual, an explicit cast should both stop the warning and make your intention clear"
Nothing hidden there at all!
How can that possibly be clear?
The line
ptr_xdata = stPtr_Obj->Adresse;
clearly has one pointer - that's ptr_xdata - and one non-pointer - that's stPtr_Obj->Adresse
The line is clearly and assignment from the non-pointer (on the Right-hand side) to the pointer (on the Left-hand side)
In any assignment, it is always the RHS that gets converted to the type required by the LHS (ie, the thing receiving the assignment).
"So the whole confusion just started by a silly english warning..."
No, the whole confusion is caused by your insistence on using words with a completely different meaning from everyone else.
If you insist on calling "left" what everyone else calls "right" then you are obviously going to cause confusion! It is you that is the cause of the confusion!
If you want to use a terminology that differs from everyone else, then it's up to you to do the conversion when communicating with others.
It's already been shown that your terminology doesn't even make sense in your native German!
"you are unable to even consider a different terminology for the same understanding (I always knew what pointers are, I just call it differently)."
OK, then - please translate the following into your terminology:
Address: 100 101 102 103 104 105 106 ...+------+------+------+------+------+------+... Memory Content: | 986 | 100 | 102 | ...+------+------+------+------+------+------+... Name: my_uint my_ptr my_ptr_ptr
The address of my_uint is 100, and the value of (ie, the value stored in) my_uint is 986; The address of my_ptr is 102, and the value of (ie, the value stored in) my_ptr is 100; The address of my_ptr_ptr is 104, and the value of (ie, the value stored in) my_ptr_ptr 102.
The address of my_uint is 100, and the value of (ie, the value stored in) my_uint is 986; The same in my terminology, because it's a normal variable The address of my_ptr is 102, and the value of (ie, the value stored in) my_ptr is 100; In my terminology the address of my_ptr is 100 the value of my_ptr is 986 The address of my_ptr_ptr is 104, and the value of (ie, the value stored in) my_ptr_ptr 102. In my terminology, the address of my_ptr_ptr is 100 and the value of my_ptr_ptr is 986. If my_ptr changes its address, the address of my_ptr_ptr also changes and thus its value. Because for me it is only relevant to concern the address the pointer points to and the value at this address. That's why a pointer to a pointer does not make sense for me at all. It makes it only harder to distinguish what's what.
And if I repeat the x-th time, I know YOUR terminology and I know MINE. Mine is easier to understand for me. You only know YOUR terminology, that's why you try so hard to convince me, that you are correct (what I don't contradict) and that I'm terribly wrong (what I also don't contradict, but I don't know why I should tell you - just because to make you satisfied for being right? No!). The code works anyway, with or without the cast. I was only a little irritated by something not self-explaining.
But one thing I have to admit you to be correct with: Struct member Adresse should be a pointer. Well, it's not my code and the strange thing is still that compiler version 7 does not warn about it, while version 8 does. But in another part of the code I used a similiar assignment and there the version 7 did warn me. That's what I meant with confusing.
And, last but not least, I found the thread somewhat funny. How people can get obsessive about this little topic...
Well, kinda flaming me for using the wrong terms
What is "kinda flaming" ? Is that along the lines of "kinda pregnant" or "kinda dead" ?
A short text search over this thread shows a complete lack of terms usually associated with flaming (like "idiot", "moron", and the like), and the only "stupid" refers to computers being stupid machines.
(if millions of people think the same way, it's not necessarily correct, as the history shows)
If you're driving on the highway and hundreds of cars are coming your way, it's most likely because you're in the wrong lane.
Hidden ? How can it be hidden ? The text on my screen is quite high contrast (black on very light grey). In fact, you have stated that you tried doing a cast and that it did not help, and then you've been asked repeatedly to post the line containing the cast so we can check whether it is correct, with no response from your part.
There's nothing "hidden". You just did not bother to read the thread, because people were asking you to use accepted terminology instead of your own inventions, which probably ticked you off.
I know you only did your best and I also know that you are so much into programming (and perhaps doing nothing else in your job) that you are unable to even consider a different terminology for the same understanding (I always knew what pointers are, I just call it differently).
Hum hum. Is that you "kinda flaming" us ?
Because when it says "conversion: non-pointer to pointer" for the line of code above, then it's clear for me that ptr_xdata is meant.
Why ? The line says that a non-pointer is getting converted to a pointer. ptr_xdata quite clearly is a pointer, so it cannot be a non-pointer. Why does this line make it clear to you that ptr_xdata is being converted ?
And this pointer is not converted, it's indirectly set to a variable.
And you're doing it again ! You're again making up terms ("indirectly set") for something that already has a clear and concise term ("implicit conversion/typecast"), and then you wonder why people are having trouble making sense of what you write. The line in question does exactly what the compiler says it does. It converts a non-pointer (stPtr_Obj->Adresse) to a pointer.
So the whole confusion just started by a silly english warning...
It's not the compilers fault that you think that a clear and concise warning message is "silly".
Wow, you native english-speaking guys (are you?) seem to be very sophisticated about terms. "Kind of flaming" just means that you nearly flamed me. Flaming just means, at least for me, that someone was blamed or accused of something without the need to do so.
Always depends on the point of view. The one driving on the (apparently) wrong lane always thinks any other driver is on the wrong lane.
I'll explain to you what I meant. To find one certain line of the many code examples in >100s posts in this thread is not easy, because I don't read any post, of course (uses too much time). The most ones where not really helpful. So I just found it was hidden, because it does not pop out so clearly that you see it at the first glance.
Actually not. I never said you are wrong. But you keep telling me. Just because I have a different view, I'm wrong in your eyes. No comparisons!
Because when it says "conversion: non-pointer to pointer" for the line of code above, then it's clear for me that ptr_xdata is meant. Why ? The line says that a non-pointer is getting converted to a pointer. ptr_xdata quite clearly is a pointer, so it cannot be a non-pointer. Why does this line make it clear to you that ptr_xdata is being converted ?
Correct me if you need to, but I understand "convert" as "turn into" or "change". The target is ptr_xdata and the source is stPtr_Obj->Adresse. Since the source is never converted (or changed) in such a case, ptr_xdata is the subject to be converted and that's why the warning does not makes, because it's actually not converted.
And you're doing it again ! You're again making up terms ("indirectly set") for something that already has a clear and concise term ("implicit conversion/typecast")...
Oh, "implicit conversion"! Wow, what an intelligent phrase. Forgive me if I'm not intelligent enough to create such phrases because my native language is not english and that I'm not learning such phrases in order to use them so that you can understand me, while "setting a pointer" turns out to be completely incomprehensible. I should be learning another meaning of the word "conversion" than I always had in my life, just to understand "implicit conversion" as you seem to understand it. For me, a conversion is still a change of type/form/shape, but the pointer is not changed in his type, it is only set to point to a new address. In my humble silly words: the pointer is set. Set to a value which represents an address of a variable, which makes the pointer point to that variable.
It was hidden amongst the many text that was written telling me what to DO NOT, instead of telling me what to DO.
In my early days in this field I lerned much more from the don'ts than from the do's.
a "don't" represent ONE thing to avoid, where a "do" usually represent one possibility of many.
Several posters in various fora have expressed ire about being told "don't" but, In my honest opinion" these (while requiring the OP to do some work, which the do's do not) are ever so much more 'educational'
Erik
PS to Andy: I am in apostroph trouble above, since this seems to be your specialty would you be kind enough to clear that up for me for "educational purposes".
In "my" terminology, the terms "address of" and "value of" always have the same meaning irrespective of whether we're talking about a pointer or any other type of variable.
"your" terminology makes the same terms have different meanings depending on whether they're applied to pointers or other variables. Where is the benefit in that?! Surely that just makes it more confusing - as the same terms have different meanings in different contexts! It's just illogical!
"That's why a pointer to a pointer does not make sense for me at all."
It would make a lot more sense if wasn't for the needless confusion of your terminology!
Just because you don't understand a thing is no reason to mess-up the terminology for people who do understand it - and, in fact, need to use it!
The diagram illustrates perfectly clearly how a pointer-to-a-pointer does have a meaning - and a logical, consistent terminology makes it easy to understand.
This is why your terminology is fundamentally flawed: because it is actually common to use pointers-to-pointers and your terminology, on your own admission, cannot handle that.
It's not that people can't conceive that a different terminology is possible; it's that your terminology is so obviously flawed and unable to cope with the real requirements of 'C' programming - such as pointers-to-pointers!
Flaming just means, at least for me, that someone was blamed or accused of something without the need to do so.
Yes, we are acusing you of being unhealthily stubborn. When the world has one definition of a metre, and a single individual decides on a distance only half as long, the problem is not semantic. We are not talking about which nuance of red that is the most beautiful. Such questions does not have a correct answer - everyone is free to have their own opinion. When it comes to the definition of a pointer, there are no room for opinions. You just have to follow the terminology of the inventors of the pointer concent - and the inventors of our programming languages - and the authors of all books - and the ...
Always depends on the point of view. The one driving on the (apparently) wrong lane always thinks any other driver is on the wrong lane. Yes - the drunkard do tend to think the others are in the wrong lane... Are you bashing yourself, or just selecting bad examples?
To find one certain line of the many code examples in >100s posts in this thread is not easy, because I don't read any post, of course (uses too much time). The most ones where not really helpful. So I just found it was hidden, because it does not pop out so clearly that you see it at the first glance.
There would not have been 100+ posts if you have spend some time and read the 5-10 first answers instead of deciding on running around blindfolded.
You would have learned why the cast was needed. You would have learned how to avoid the cast. You would have learned the terminology needed to read books. You would have learned why multiple indirection is both needed and elegant.
Sorry, we can't chew your food for you. Some things must be up to you. If you like running around with a blindfold, you will get a lot of bumps in your head.
Correct me if you need to, but I understand "convert" as "turn into" or "change".
And if you had spent just a tiny little bit of time reading this thread, you would know that you can convert binary data. You can convert data types. You decided that convert must be a binary conversion, and failed to realize that the compiler has more than a single attribute it cares about for a variable. It careas about the name, the type, the size, the location, ... In this case, the types did not match, so the compiler had to do a type conversion. But not of the pointer. It needed to to a type conversion of the integer. The source had to be converted to fit the destination, i.e. the standard way (and only way possible) in programming languages with pre-typed variables.
Oh, "implicit conversion"! Wow, what an intelligent phrase.
Explicit and implicit (and what they stands for) are standard words in most (all?) modern languages. I agree - there are natives living in the jungles who may not have a need for this concept. But they are the exception.
Explicit type cast: You have to inform the compiler. Implicit type cast: The compiler have to figure out the conversion itself.
I should be learning another meaning of the word "conversion" than I always had in my life, just to understand "implicit conversion" as you seem to understand it.
Not at all. You just have to realize that there can be more than one attribute involved, so it need not be the value that needs conversion. In this case it is the data type. In some cases, a type conversion will imply a conversion of the value too.
In my humble silly words: the pointer is set. Set to a value which represents an address of a variable, which makes the pointer point to that variable.
Exactly. The pointer's value is an address. But that is not what you have argued about time and time again in this thread. Do you have so twisted terminology that you don't remember what your point is, even in your own terminology? You have again and again and again claimed that the value of the pointer is the value of the integer, instead of the address of the integer, and that addresses of pointers are irrelevant.
but the pointer is not changed in his type... No, but the integer (Adresse) is changed in his (masculinum?) type since the compiler (explicitly or implicitly) has to convert from the uint data type to a pointer data type. Did you forget that? Do you have so twisted terminology that you don't remember what your point is, even in your own terminology?
You just have to follow the terminology
because I don't read any post, of course (uses too much time).
the above made me realize that writing posts to help you and others "of course (uses too much time)". I will definitely consider that in the future.
so, if anyone wants to help Maik Staberock they should be aware that doing so "uses too much time" and refrain.
The Address Of a variable always means the memory address at which that variable itself is located - no ifs, no buts, no exceptions = no confusion;
The Value Of a variable always means the value stored in the variable itself - again, no ifs, no buts, no exceptions = no confusion;
How can adding complexity by having the terms mean different things in different contexts be anything but more confusing?!
"Kind of flaming" just means that you nearly flamed me.
Yes, and "nearly flamed" makes about as much sense as "nearly pregnant".
You may consider youself flamed if you see certain four-letter words and clearly derogatory insults (idiot, moron, and the like).
The driver who thinks that he's in the correct lane and everyone else isn't needs to have his license yanked as soon as possible, and probably needs to seek medical help.
I'll explain to you what I meant. To find one certain line of the many code examples in >100s posts in this thread is not easy, because I don't read any post, of course (uses too much time).
The first posting that mentions an explicit cast as the solution to your problem is the second response (the first response to the original posting was actually written by you. Reading the second posting takes too much time ? That does not make sense.
Actually not. I never said you are wrong.
Oh yes you do. We are wrong for not following along with your made-up terminology. That statement is pretty much implied in any of your postings on the matter.
Correct me if you need to, but I understand "convert" as "turn into" or "change". The target is ptr_xdata and the source is stPtr_Obj->Adresse.
O ... kay.
The line in question tells the compiler the following:
1. Take the value of stPtr_Obj->Adresse. 2. (implicit) Convert this value to the datatype of ptr_xdata if necessary. 3. Assign this value to the variable ptr_xdata.
Step 2 involves turning a non-pointer (the value of stPtr_Obj->Adresse) into a pointer (the data type of ptr_xdata). This is very clear to the compiler, since the C standard demands it. If you think the compiler should not adhere to the C standard, but follow your line of thinking, then you need to write your own compiler (possibly with your own programming language, since that compiler won't qualify as a C compiler).
It's not about intelligence. It's about the terminology used in the C standard and the literature. It's about the terms that seasoned C programmers will use and understand. It's about being concise and getting your point across.
You don't need to be intelligent to use the correct terminology. However, you need to want to use the correct terminology, and this seems to be somewhat lacking. You are posting in English, so you're following some of the conventions. What's so difficult about going all the way and actually using the right terms ?
The compiler does not care about "represents". It does not know what a variable is supposed to represent. It cannot read you mind. For the compiler, you are assigning an integer to a pointer, and this requires a type conversion.
In this thread you are advising:
ever tried an internet search with the wrong terminology
Yet in another thread you are insisting that your terminology is perfectly acceptable:
http://www.keil.com/forum/docs/thread11843.asp
Even though Google tells us:
Your search - "merging execution strings" - did not match any documents.
I find it extraordinary that you are arguing the same argument from opposite standpoints in two threads simultaneously.