le 2001/06/09 22:28, Hans van Maanen à hans@... a écrit : > > Hans "never write more than you need" van Maanen as programmers we have responsability to our users. if that user is you - damn the torpedos. but even in that case there is an argument that you should use correct programming practise, as the day you cut and paste a line or two, you may not remember that you left out all error checking. to answer your remarks: > So if > th& = 0, there's little I can do anyway. Can I? From what i understand, if the handle is empty, then there is nothing on the clipboard. so this is a prefectly normal situation. where there is something on the clip then it would replace content elsewhere and your cancel function should take this into account. if the clip is empty, then you would just gracefully exit as this is unneeded. > e = FN HLOCK() > LONG IF e = _noErr > ... > END IF > > Why not just: > > e = FN HLOCK() > ... > e = FN HUNLOCK() > > and damn the consequences. What say you? here i would disagree further, even with the talented programmers who have counseled you so far, i would 98% of the time get the handle state, save that state, lock the handle, check the error, and at the end restore it to the previous state. this is such an automatic choice that you should have a tinplate function to do that. i have stated this many times in the past [but perhaps you weren't around them... i mean in those days the fblist was just scratched up on a cave door somewhere... :-) ] [BTW. is e = _noErr still valid? I thought that that had changed?] is it important to check for errors? yes siree. whether you are using 30Kb of memory or 3Gb. If you can't get the memory you need, or you can't manipulate it as you need, you should inform your user and gracefully bail out. this will never happen of course, but the time it does happen your user will be happy that you did it. has it also ocurred to you that perhaps your app is fine, but that another app is running rampage over the memory and trampling in your area? [this will happen even under OS X, as classic apps all share the same memory place. it won't bring the X space down, but it will mess up the classic box.] And you can't go complaining about that other wild app, if you don't program to the rulebook either! A long time ago i wrote a memo on recovering gracefully from errors... i'll try and dig it up, update and repost. :-j