@Karlos
Quote:
Maybe you'll be lucky most of the time and the ln_Succ member at whatever address/offset the original node existed at a moment ago is still valid but to assume so would be foolhardy at best.
Your assuming that that you have more then one thread or there are many applications, sorting the list, deleing nodes, and adding nodes, while this program is the for loop then yes.
If if assume that this ia isolated list where only this program has control of what happens, then we can assume that address of ln_succ will be untouch after the current node is freed.
Quote:
Look, Mutexes and Semaphores are there to ensure a resource is properly accessed in a concurrent environment.
I agree a resource in the form of a list or node maybe?
Quote:
They are not there to protect you from playing Russian Roulette with pointers.
A pointer can also be a resource your trying to protect.
But its important that is what ever you do you need to make shore its not a some thing that OS expects being protected by Forbid() / Permit(), it should be oblivious way this wont work.
I can understand you want the OS to deal whit it, but then you need a stub not a macro, or else the legacy will just break any improvement.
I don't see how it even possible to implement a sort of obtain / release mechanism based on fact that application is simply asking for the successor node, thats simply assuming too mutch, nor will it work in this code example.
Quote:
You have no idea what L_FreeFiletype()
We need to assume it does what code imply it does, free one node, not a pool of memory. Or else the code is buggy and broken, and some one needs to fix it.
Edited by LiveForIt on 2013/6/2 2:44:38
Edited by LiveForIt on 2013/6/2 8:05:08