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: 102b75,be3d6a6131c61fa7 X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,be3d6a6131c61fa7 X-Google-Attributes: gid1164f8,public From: andrew@gurney.reilly.home (Andrew Reilly) Subject: Re: Did Intel pay UGS to kill Alpha port? Or Compaq simply doesn't care? Date: 1999/04/12 Message-ID: <7eu1cd$ils$1@m2.c2.telstra-mm.net.au>#1/1 X-Deja-AN: 465677722 References: <36E9F2A0.9A401A09@pacific.net.sg> <7cj96m$h07$1@plonk.apk.net> <7eih45$ln2$1@news.doit.wisc.edu> Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@m2.c2.telstra-mm.net.au X-Trace: m2.c2.telstra-mm.net.au 923961549 19132 24.192.50.137 (12 Apr 1999 23:59:09 GMT) Organization: at home Mime-Version: 1.0 Reply-To: reilly@zeta.org.au NNTP-Posting-Date: 12 Apr 1999 23:59:09 GMT Newsgroups: comp.arch,comp.sys.dec,vmsnet.alpha 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 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. -- Andrew Reilly