Gunnar Dalsnes wrote:
If you come across a crash during an enum you just temporarily change
the code to hunt the bug, just like normal bug hunting. Some of the
list enums i changed were on this form...
No, not like during normal bug hunting. Durnig normal bug hunting I add
some dprints. During macro bug-hunting I revert the code to make it stop
using the macro (potentially making a mistake and introducing a bug),
add the debug prints, get it working, then attempt to add the macro
again (and potentially make a mistake). More work for me, and more
potential for bugs.
for (HeadList = &Foo.Flink; Entry != HeadList; Entry = Entry->Flink)
{
Object = CONTAINING_RECORD(Entry, OBJECT, Link);
Object->stuff
}
...and if you had to "debug" it like you showed youd had to edit the
code just as well.
That's because that loop is really ugly. I don't think I'd ever write a
loop like that for manipulating list entries.
But for normal not-in-process-of-being-debugged-code i
think the above
code sux (even without the dprints).
Yeah it does, it should be expanded to properly show each step line by
line. Not macroized into a single unmaintainable ..thing.
Best regards,
Alex Ionescu