A discussion on IRC made me realize this hasn't been thouroughly enough used in the current code.
As most of you know, I'm a devil when it comes to finding and fixing memory related bugs, and even that I've been away from AW coding for a more than resonable time, I still in some wicked way feel responsible for AbiWord memory related bugs since I was basically the one that brought up this issue a long time a go. Possibly there is some philosophical thing here, but that would be beyond this "rant". :-) I propose the following: Add asserts wherever applicable. Add asserts to the "impossible" value, since that value _is_ to be impossible. Add asserts to apparently impossible places. Add a debug-only function IsValidReadAddress(const void*); and IsValidWriteAddress(void*); For Win32 that would be mapped to IsBadReadPtr & co., and for *nix I'd expect something similar to be present (even if implemented in terms of a segv signal handler). But for debug mode, add whatever you can to verify parameters, variables and just about anything. F.ex. I can mention a BOOL (whatever we called them back then) that could gain the value 0xcc when using a good compiler. Nowadays bool's aren't that bad, but you get the drift. I'm not proposing all should make these changes now. I propose this should be policy to be implemented from now on, and whenever appropriate when visiting old code that lacks assert, you should add assert wherever you feel it suitable. Dom? /Mike
