TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: JAMES VAHN
from: DARRYL GREGORASH
date: 1998-01-20 12:03:00
subject: circular buffer

Replying to a message of Darryl Gregorash to James Vahn:
 DG> If you have a stack, then you only need one pointer, unless
 DG> you absolutely must preserve the first unread byte written
 DG> to the stack (and I don't know why anyone would want to do
 DG> that).. you always read and write using it. Increment and
 DG> write, read and decrement.
Well, this is of course incorrect even for a circular stack.. there must be 
some condition to determine stack underflow. Overflow isn't a problem with a 
circular stack, unless you need to check if it has happened for some reason.. 
but to determine underflow in a circular stack, either you need a second 
pointer, or you need a DB containing the number of elements currently on the 
stack. I prefer the second method myself.
--- FleetStreet 1.21 NR
---------------
* Origin: BIG BANG Burger Bar: Regina SK Canada (1:140/86)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.