On Fri, 03 Oct 2003 13:17:26 +0200 [EMAIL PROTECTED] wrote: > ------- Additional Comments From [EMAIL PROTECTED] 2003-10-03 13:17 ------- > I have finally fixed it. Function that copies messages didn't report > that copying was cancelled and one function above deleted all those > messages thinking they were copied successfully.
Ok, I see. So this is unrelated to 798, right? > Lessons to learn from this: > > 1) Cancelling is error (from point of view of the code). It just has no > associated error message. Yes, but it's still an error and so should result in an error return code. This is what I don't understand: you can forget to set "cancelled" flag but this should result in an extra error message, it shouldn't result in messages being deleted. I.e. if a real error occurs, messages wouldn't be deleted, so why were they if the operation was cancelled? > 2) Failure indicator variables are evil, because somebody will > inevitably forget to set them. All errors should be followed by return > false, leaving cleanup for destructors. Hard to argue with this, it is already supposed to be done like this. "Cancel" is the only (unfortunate) exception but, again, failing to set this flag shouldn't be catastrophic -- just an extra error message... > 3) We should consider using exceptions, so that return false cannot be > ignored. First of all, it can still be ignored pretty well -- and the program would just explose in the mid air. Second, I don't believe that it is easier to to write exception-safe code than to check the functions return values. Third, we can't do this with the existing code base anyhow (which is massively exception unsafe) and so it remains wishful thinking. Finally, fourth, I have no idea about how to combine exceptions with multiple thread (which I still hope to have one day) in any reasonable way. So please let's continue using return codes for now. Exceptions could be used in isolated parts of the code from where they are sure not to propagate to the main program, but that's about it. Thanks, VZ ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Mahogany-Developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mahogany-developers
