Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Circular Buffer

Name: Anonymous 2011-01-06 10:01

Hi /prog/

Some time ago I started to write a well designed library of useful algorithms in C. As long as I needed more stuff, I simply added pieces.

Today I'm pretty bored, so I'd like to add an implementation for circular buffers. Since however I don't really need it (it's just for fun), I'm wondering which is the most useful semantics for a circular buffer.

For instance:
[list]
[*] Is it worthy to write a primitive which applies a function on every availabe element from the oldest to the most recent?
[*] What if the buffer is full and I want to insert a new element? Should I overwrite the oldest one or should I make the request fail instead?
[/list]

Which are, in general, the kind of functionalities you'll prefer?

Name: Anonymous 2011-01-08 7:47

$ bbcat ~/text/THANKS.bbc
bash: bbcat: command not found
$

Name: Anonymous 2011-01-08 7:55

$ sudo bbcat ~/text/THANKS.bbc
sudo: This is not ubuntu, faggot.
$

Name: Anonymous 2011-01-08 8:01

>>25
$ sudo apt-get install bbcat

Name: Anonymous 2011-01-08 8:06


$ sudo apt-get install bbcat
bash: sudo: command not found
$

Name: Anonymous 2011-01-08 8:21

$ sudo why are you using code tags
sudo: Fuck off, Rand(all).
$

Name: Anonymous 2011-01-08 8:25

>>27
$ sudo apt-get install bbcat
sudo: This is not ubuntu, faggot.
$ cat ~/bin/sudo
#!/bin/sh
echo "sudo: This is not ubuntu, faggot"
$

Name: Anonymous 2011-01-08 9:17

>>30 Really?
$ cat `which sudo`
#!/bin/sh
tail -1 $0
exit 1
sudo: This is not ubuntu, faggot
$

Name: Anonymous 2011-01-08 9:26

>>31
GNUSudo detected!

Name: Anonymous 2011-01-08 9:27

>>31
#!/bin/sh
echo `basename $0`: `tail -1 $0` && exit 1
This is not ubuntu, faggot

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List