You are not logged in.

#1 2004-07-12 22:55:10

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

examples on great code used in linux

        if(ct<0)
                ct=2;        /* Shit happens.. */
        linux-2.6.6/drivers/net/wan/z85230.c

this makes me think about creating backups more often :-)


The impossible missions are the only ones which succeed.

Offline

#2 2004-07-12 23:30:18

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: examples on great code used in linux

hehehe, no I understand why Linux lacks wifi drivers! big_smile


arch + gentoo + initng + python = enlisy

Offline

#3 2004-07-12 23:47:11

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: examples on great code used in linux

as long as they do not use something like this

if (value == 0)
     return value;
 else
     return 0; 

to make linux not too fast, it's ok :-)

or imagine something like this:

if (a)
 {
     /* do something */
     return x;
 }
 else if (!a)
 {
     /* do something else */
     return y;
 }
 else
 {
     /* do something entirely different */
     return z;
 }

when is z returned? maybe when a is transcendent?


The impossible missions are the only ones which succeed.

Offline

#4 2004-07-13 10:10:41

zeppelin
Member
From: Athens, Greece
Registered: 2004-03-05
Posts: 807
Website

Re: examples on great code used in linux

pacman -S fortune-mod-kernelcookies
and then (in console or in your wanda applet [GNOME!!])
fortune linuxcookie

Offline

#5 2004-07-13 10:16:12

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: examples on great code used in linux

zeppelin wrote:

pacman -S fortune-mod-kernelcookies
and then (in console or in your wanda applet [GNOME!!])
fortune linuxcookie

fortune kernelcookies >> $kernelsource/buffer.c 

exactly! :-)


The impossible missions are the only ones which succeed.

Offline

#6 2004-07-14 18:52:12

Haakon
Member
From: Bergen, Norway
Registered: 2004-05-09
Posts: 109

Re: examples on great code used in linux

Helping new students at my university, I have several times seen java code like this:

boolean a = blabla;
if (a == true) return true else if (a == false) return false else blabla...

It's horrible.


Jabber: haakon@jabber.org

Offline

#7 2004-07-14 19:52:49

whatah
Member
Registered: 2003-08-10
Posts: 114

Re: examples on great code used in linux

there are a lot more stealthy code bugs you can find.
i.e.

for (unsigned int i = somevalue; i >= 0; i--) { }

Offline

#8 2004-07-20 21:27:10

ravster
Member
From: Queen's U, Kingston, Canada
Registered: 2004-05-02
Posts: 285
Website

Re: examples on great code used in linux

whatah wrote:
for (unsigned int i = somevalue; i >= 0; i--) { }

Oh, crap. Infinite loop.
Run for your lives!! :twisted:

Offline

#9 2004-07-20 21:29:26

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: examples on great code used in linux

ravster wrote:
whatah wrote:
for (unsigned int i = somevalue; i >= 0; i--) { }

Oh, crap. Infinite loop.
Run for your lives!! :twisted:

[damir@Asteraceae damir]$ fortune -m 'infinite loops'
(linuxcookie)
%
"We all know Linux is great...it does infinite loops in 5 seconds."
(Linus Torvalds about the superiority of Linux on the Amterdam
Linux Symposium)
%

The impossible missions are the only ones which succeed.

Offline

#10 2004-07-20 22:47:35

markj
Member
From: Wales, UK
Registered: 2004-03-02
Posts: 10

Re: examples on great code used in linux

try this

cd /usr/src/linux <-- or wherever you put your kernel source
egrep -ir "f*%k" *

You can guess what word goes there i hope

Offline

#11 2004-07-21 18:42:01

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: examples on great code used in linux

markj wrote:

try this

cd /usr/src/linux <-- or wherever you put your kernel source
egrep -ir "f*%k" *

You can guess what word goes there i hope

actually grep'ing for this word in sources can be used as a quality-indicator on software - but as it also heavily depends on the "language" used by the programmer, it is not a good indicator - it is not correlated unconditioned (people using such words may be also good programmers)


The impossible missions are the only ones which succeed.

Offline

#12 2004-07-23 09:48:01

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: examples on great code used in linux

sometimes I wonder if the swiss are an alien colony....


arch + gentoo + initng + python = enlisy

Offline

#13 2004-07-23 10:04:21

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: examples on great code used in linux

xerxes2 wrote:

sometimes I wonder if the swiss are an alien colony....

me too :-) ... why? because of my avatar? because of the nonsense i'm writing?


The impossible missions are the only ones which succeed.

Offline

#14 2004-07-23 10:18:42

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: examples on great code used in linux

very nice avatar, Sweden summer suuuuuuuuucks

even to cold for the bugs.


arch + gentoo + initng + python = enlisy

Offline

#15 2004-07-23 13:28:30

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: examples on great code used in linux

xerxes2 wrote:

very nice avatar, Sweden summer suuuuuuuuucks

even to cold for the bugs.

feel free to come to basel to enjoy 32°C - (it's too hot to even breathe the air)


The impossible missions are the only ones which succeed.

Offline

#16 2004-07-23 16:48:13

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: examples on great code used in linux

Or come to Victoria, it's the same here.  We're going through a heatwave.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#17 2004-07-23 21:13:59

neotuli
Lazy Developer
From: London, UK
Registered: 2004-07-06
Posts: 1,204
Website

Re: examples on great code used in linux

Chicago is a pleasant 21°C today, but knowing our weather it could be 35 or -20 tommorow...we have world-renouned weather unpredictability  :?  . 
As for the topic... try http://kerneltrap.org/node.php?id=542 There's no shortage of...interesting....code comments there...


The suggestion box only accepts patches.

Offline

#18 2004-07-24 05:20:27

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: examples on great code used in linux

and here it's still raining...


arch + gentoo + initng + python = enlisy

Offline

#19 2004-08-13 22:30:20

Matt3030
Member
From: Victoria, BC
Registered: 2004-08-13
Posts: 12

Re: examples on great code used in linux

Xentac wrote:

Or come to Victoria, it's the same here.  We're going through a heatwave.

Yeh... it was hot here for awhile eh? I can't believe it's only rained a couple times this whole summer though, that's crazy compared to vancouver (where I'm originally from).

Offline

Board footer

Powered by FluxBB