Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!purdue!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!unido!rmi!infoac!infohh!shimoda From: shimoda@infohh.rmi.de (Markus Schmidt) Newsgroups: comp.sys.amiga.tech Subject: Re: Double click detection? Message-ID: <490@infohh.rmi.de> Date: 3 Feb 89 18:45:51 GMT References: <8901301541.AA05371@PTT.LCS.MIT.EDU> Reply-To: shimoda@infohh.rmi.de (Markus Schmidt) Organization: RMI Net * Aachen/Hamburg/Flensburg * W.Germany Lines: 34 )% )%| shimoda@rmi.de `---' The last remaining adventure | )%| shimoda@gopnbg.UUCP |O o| since there are no more tigers: | ) )Please correct me if I am wrong, but doesn't this code fragment )contain two Bad Things? No Guru has yet responded, so I thought I )would take a shot at sticking my foot in my mouth. ) )It busy-waits. There is no call to Wait(), or WaitPort() before the )GetMsg(). Even if you are busy-waiting only while looking for double )clicks, you shouldn't. ) )GetMsg() will return NULL if no message has yet arrived. With the )various 'if (imsg-> ... )' tests, you are then indirecting through )address 0, which while not necessarily fatal, is sloppy and will quite )likely break on any system with memory protection (unless it's a VAX :-). )Even if you do call Wait(), you should not depend on GetMsg() )returning something non-NULL. ) )Andrew Heybey, atheybey@ptt.lcs.mit.edu Room 509, 545 Technology Square .-----------------------------------------------------------------. Of course you are right both times. As I said, it was hacked down online so forgive me if this caused any trouble. Next time I will be more reliable. I just left out anything except the DoubleClick-stuff. Thank you anyway. | shimoda@rmi.de `---' The last remaining adventure | | shimoda@gopnbg.UUCP |O o| since there are no more tigers: | | ==Y== Doublebuffered async. I/O _ | |----------------------- `U' ------------------------------ _ // | | Good terminalpackages begin with A: AmigaCall, A-Ta.. \// | `-----------------------------------------------------------------'