From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f8a1,e7e13c943c611b62 X-Google-Attributes: gid10f8a1,public X-Google-Thread: 1164f8,be3d6a6131c61fa7 X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,be3d6a6131c61fa7 X-Google-Attributes: gid102b75,public From: handleym@ricochet.net (Maynard Handley) Subject: Re: Did Intel pay UGS to kill Alpha port? Or Compaq simply doesn't care? Date: 1999/04/16 Message-ID: #1/1 X-Deja-AN: 467227480 References: <36E9F2A0.9A401A09@pacific.net.sg> <7cj96m$h07$1@plonk.apk.net> <7eih45$ln2$1@news.doit.wisc.edu> <7eu1cd$ils$1@m2.c2.telstra-mm.net.au> Organization: Apple Computer, Inc. Newsgroups: comp.arch,comp.sys.dec,vmsnet.alpha In article <7eu1cd$ils$1@m2.c2.telstra-mm.net.au>, reilly@zeta.org.au wrote: >In article , > handleym@ricochet.net (Maynard Handley) writes: >> Am I the only person in the world who writes every single damn function he >> types up as >> >> #if DEBUG >> #define FLAG_ERROR(error) if(error!=noErr) Debugger() >> #else >> #define FLAG_ERROR(error) >> #endif >> >> error=CallSomeFunc(...); >> FLAG_ERROR(error); >> >> I have never seen any other code that does this, yet the pain it saves is >> immeasurable. Regardless of whether or not I can do anything useful >> subsequently with the error, the very fact that I catch the problem in the >> debugger at the source, not 50 corrupted memory blocks later is >> extraordinarily useful. > >Catching errors early is obviously a good thing, but how is this >mechanism different from using an assert() in the code that is >generating the condition code in the first place? Of course >that way lies design-by-contract, Eiffel, and who knows: >bug-free code? I'm not sure what your point here is. The vast majority of us are continually making calls into the OS and the standard OSs (UNIX/Win/Mac) generally return that something went wrong with an error code (of course there are always the oddball functions that behave differently). Certainly within ONE'S OWN functions, one wants to put ASSERT()s at the entry into the function, but one has little control over what the OS is doing. >I guess your way allows you to decide what is an error condition >in the caller, rather than the callee, but that sounds a bit >like another assertion to me. > >Always keen to see a new way to catch bugs, so thanks for that. Maynard