xdata struct EEPROM {
unsigned int Last_Data; struct EEPROM *Node; };
struct EEPROM xdata * xdata p; p = (struct EEPROM xdata *)0x0FF6; if i will print the following statement printf("Size of p = %d",(unsigned int)sizeof(*p));
then it will shows the 5,but actually it should show the 4 bytes
You need to refer to the documentation about generic and memory specific pointers. Your code does show you the correct number of bytes. Your guess is incorrect.
http://www.keil.com/support/man/docs/c51/c51_le_ptrs.htm
Here: http://www.keil.com/forum/docs/thread8939.asp
a link list is an excellent idea if you want your project to come to a crawl.
I have no idea why, somehow, the link list has become a part of C, it has nothing to do with language.
The link list is a very ineffective means of storing stuff and, in addition, require 'unlimited' memory which the '51 definitely does not have.
WHAT IS WRONG WITH arrays and structures?
I would greatly appreciate if someone could tell me a reason for using a link list other than "It is easy". That it is "open ended" is irrelevant, in a '51 it WILL end when you run out of memory
Erik
" it has nothing to do with language."
Correct: it's a fundamental tool in any computing environment - so you'd expect any real language to support it! And any programmer to include it in their "armoury"
"The link list is a very ineffective means of storing stuff"
Not necessarily. Linked lists are particularly useful when your data needs to be easily re-ordered without copying it.
"require 'unlimited' memory"
Completely untrue! As previously discussed, statically-allocated linked lists are perfectly common.
"I would greatly appreciate if someone could tell me a reason for using a link list"
See above. As we're talking EEPROM here, it might be something to do with wear-levelling?
For another example, see 'It is easy'"
Surely that could be an entirely valid reason?
Not necessarily. Linked lists are particularly useful when your data needs to be easily re-ordered without copying it. no more useful than re-ordering pointers in an array
"require 'unlimited' memory" Completely untrue! As previously discussed, statically-allocated linked lists are perfectly common. if open-ended is not a desire, then using a linked list becomes even more silly.
"other than 'It is easy'" Surely that could be an entirely valid reason? 1) easier than what 2) "It is easy'" is thr most often used excuse for writing ineffective code.
Just mentally go through the process of getting to the last entry in a linked list as opposed to getting to the last entry in an array of pointers. Point taken?
View all questions in Keil forum