home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.programming      Programming issues that transcend langua      57,434 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 56,672 of 57,434   
   Ben Bacarisse to David Brown   
   Re: A little puzzle.   
   24 Nov 22 13:23:51   
   
   From: ben.usenet@bsb.me.uk   
      
   David Brown  writes:   
      
   > I use circular buffers a great deal in my coding.  For many of my   
   > systems, there are UART communication ports (such as for debugging   
   > output - when you don't have a screen or standard output, a UART does   
   > the job).  There is typically a circular buffer which is piped out to   
   > the port via interrupt routines, and when the application code wants   
   > to "print" out a message, it gets pushed into the buffer.   
      
   Yes, and I've used circular buffers before, but always as queues so   
   there was never a need to know if an index (or pointer) is in the filled   
   or unfilled region.  One just had to avoid confusing a full buffer with   
   an empty one.   
      
   > So the kind of thought needed for Ben's "puzzle" turns up in real   
   > code, and I've seen people get it wrong.   
      
   What's the modulo solution you had in mind?   
      
   --   
   Ben.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca