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

Link List

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

Parents
  • " 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?

Reply
  • " 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?

Children
  • "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.

    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?

    Erik