Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

mackscynox

is this logical

This topic is 5183 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

think about a linked list structure and its nodes as nodes are pointers and lets say the programmer can access the node pointer if it wants to (for reading or editing the data that it holds) but if the programmer tries to delete the pointer no check is performed here to prevent the user so i made a linked list like that: - node and list are both different classes (template classes) - in the node destructor i check the chains(next , prev...) and if they are NULL that means this node belongs to no linked list and donot perform "remove from list" actions - if the node''s chains are not NULL (any of them) this means this node belongs to a valid linked list so SHOULD perform "remove from list" actions AND all these checks are made in destructor of node class i just want to ask that whether this is a logical programming technic to prevent linked list''s validity o should i prevent the user''s access to node pointers or any such? i use the above technic that i explained in my all linked list types , also in all tree,linkedlist,queue.... structures (i hope i explained the situation)

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!