Jump to content
  • Advertisement


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


is this logical

This topic is 5357 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

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!