*BSD News Article 33946


Return to BSD News archive

Xref: sserve comp.os.386bsd.misc:3067 comp.os.linux.misc:21246
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!newsfeed.ksu.ksu.edu!moe.ksu.ksu.edu!vixen.cso.uiuc.edu!sdd.hp.com!spool.mu.edu!howland.reston.ans.net!swrinde!sgiblab!idiom.berkeley.ca.us!apollo.west.oic.com!apollo.west.oic.com!not-for-mail
From: dillon@apollo.west.oic.com (Matthew Dillon)
Newsgroups: comp.os.386bsd.misc,comp.os.linux.misc
Subject: Re: source of TCP/IP (was I hope this wont ignite a major flame ...)
Date: 4 Aug 1994 15:02:52 -0700
Organization: Obvious Implementations Corp
Lines: 64
Distribution: world
Message-ID: <31roic$c5i@apollo.west.oic.com>
References: <31od8d$15l@fw.novatel.ca> <31pc9l$ctp@oscar.agcs.com> <michaelv.775964561@ponderous.cc.iastate.edu>
NNTP-Posting-Host: apollo.west.oic.com

:In <31pc9l$ctp@oscar.agcs.com> robertsw@agcs.com (Wallace Roberts) writes:
:
:>hpeyerl@sidney.novatel.ca (Herb Peyerl) writes:
:
:>	[ ...snip happens... ]
:
:>>I've tried reading Linux networking code. At least some of the device 
:>>drivers and each of the ones I looked at gave me a brain hemorrage...
:>>
:>>This is an example of some of the Linux device-drivers I've seen:
:>>
:>>        short error = rx_status & 0x3C00;
:>>        outw(inw(ioaddr + 0x0A) | 0x00C0, ioaddr + 0x0A);
:>>
:>>As far as I can tell; Linux Ethernet device-drivers were written in
:>>Write-Only-C.  There are no comments in the surrounding code that in any
:>>way indicates exactly what "0x3c00", "0x0a", "0x00c0" actually mean. To
:>>people without docs (usually these are the people who are trying to fix
:>>the code) the above is completely meaningless.
:
:>if you're writing (or fixing) a device driver, you are expected to have
:>the h/w manuals handy.  comments are unnecessary if you have the device
:>manual & understand the h/w.  this is the expected level of competence
:>for a programmer writing or fixing a device driver.
:
:In other words: real hackers don't need comments, because they can
:figure it out from the magic numbers.
:
:Yup, that's a real strong argument.  Sheesh!  Even Microsoft writes
:their code better than that... (Yes, I do know.)
:
:-- 
:- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
: Michael L. VanLoon                 Iowa State University Computation Center
:    michaelv@iastate.edu                    Project Vincent Systems Staff
:  Free your mind and your machine -- NetBSD free Un*x for PC/Mac/Amiga/etc.
:- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    I agree with the original poster.  It's bad enough that some people do not
    comment their code *at all*, not even the esoteric magic.  But what really
    gets up my goat are the bug fixes... someone fixes a bug, doesn't bother 
    to comment either the fix or the reason why it was screwed up in the 
    first place, and 6 months later someone else unfixes it (repeating the 
    same mistake that caused the bug in the first place).  At least *I* 
    took a little time to comment what the frig the TCP states really meant 
    in inet/tcp.c (linux)!  Don't anyone dare delete them!

    But if you are really looking for something to gnaw on, how about the
    comments at the head of any source file?  You take just about any major
    distribution and what you get are two pages worth of copyright information
    at the beginning of EACH source file, and not ONE IOTA describing what 
    the hell the purpose of the source file is!  It would be nice if people 
    put a reasonable comment at the top of their source files :-)

						-Matt

-- 

    Matthew Dillon		dillon@apollo.west.oic.com
    1005 Apollo Way		ham: KC6LVW (no mail drop)
    Incline Village, NV. 89451	Obvious Implementations Corporation
    USA 			Sandel-Avery Engineering
    [always include a portion of the original email in any response!]