[ was Re: [FB] FN DISPOSHANDLE ] >>e = FN HLOCK() This does not work in FB^3. Are you using FBII? In FB^3, an error-check for locking an existing handle block might look like this: dim err as OSErr call HLock( theHandle ) err = fn MemError long if ( err == _noErr ) ...do your normal stuff xelse ...do something about the error: _nilHandleErr or _memWZErr end if In practice, few programmers would make tedious checks like this (are we really going to test _everywhere_ we call HLock, HUnlock, HGetState, HSetState, GetHandleSize, DisposeHandle and so on?). No, madness lies that way. If the handle is valid these calls 'cannot' fail. Instead we check further up the line, at places where a handle (or pointer) manipulation could plausibly fail, namely calls to: Routine Error test ------- ---------- NewHandle and variants test for _nil handle TempNewHandle result-code parameter SetHandleSize MemError MoveHHi MemError HandAndHand returns error code HandToHand returns error code EmptyHandle MemError GetResource and variants test for _nil handle NewPtr and variants test for _nil pointer SetPtrSize MemError PtrAndHand returns error code PtrTohand returns error code PtrToXHand returns error code So many different kinds of test to remember... :-( >> All you can do is XELSE : BEEP : END or, maybe a bit more >>gracefully, alrt = FN STOPALERT(_bye,0) : END >>But seriously, I see the usefulness of checking for unexpected >>errors, but only if I have a way to do something about them. So if >>th& = 0, there's little I can do anyway. Can I? >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. These raise the important question of how to react to an error. If myHandle = fn NewHandle( 0 ) fails, you won't have enough memory even to display an alert without crashing. I once saw an ingenious method of reserving a few tens of K at startup, which is then released before the terminal out-of-memory alert is called up. Anyone know where details of this technique can be found? Robert P.