Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 11 May 2011 07:54:34 -0500 Message-ID: <4DCA870B.2A33@mindspring.com> Date: Wed, 11 May 2011 08:54:35 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.unix.programmer,comp.lang.c Subject: Re: Avoiding recursive stack overflow in C on Unix/Linux? References: <2f33e674-b127-4c35-89b5-dcbf564f3aab@h36g2000pro.googlegroups.com> <92rabuF51pU6@mid.individual.net> <87zkmvhyqm.fsf@temporary-address.org.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 25 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.223.42 X-Trace: sv3-4qzMplGOyEC3klp1OgvI5QGOytJENRQ1oYP0TPx0jjx+c50z4yjjpDufkO4vgW82T5IO45IwSs9hGaS!EnUOMwP2dbgoaLFpnEErmzNJbifJYnz0H5b3aF/yvFHXiUF7+mrrBACPsoy37eQ2O7mH1Ge5xN3C!eJvbdUTj6Q== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2286 Xref: x330-a1.tempe.blueboxinc.net comp.unix.programmer:527 comp.lang.c:3747 ImpalerCore wrote: > /* > * l - low boundary of region to search > * h - high boundary of region to search > * m - median of region to search (if array is sorted) > * m_p - pointer to the corresponding median object in the > array. > */ > l = 0; > h = array->size - 1; > l = m + 1; > h = m - 1; I don't use any of those 1's (ones), when I write binary search. I let the initial value of h be equal to the index of the element which is one past the end of the array. -- pete