mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Moffett <mrmacman_g4@mac.com>
To: linux@horizon.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: kernel guide to space
Date: Tue, 19 Jul 2005 23:41:35 -0400	[thread overview]
Message-ID: <FD559B50-FB1E-4478-ACF4-70E4DB7A0176@mac.com> (raw)
In-Reply-To: <20050714011208.22598.qmail@science.horizon.com>

On Jul 13, 2005, at 21:12:08, linux@horizon.com wrote:
>>> I don't think there's a strict 80 column rule anymore.  It's 2005...
>
>> Think again.  There are a lot of people who use 80 column windows so
>> that we can see two code windows side-by-side.
>
> Agreed.  If you're having trouble with width, it's a sign that the  
> code
> needs to be refactored.
>
> Also, my personal rule is if that a source file exceeds 1000 lines,  
> start
> looking for a way to split it.  It can go longer (indeed, there is  
> little
> reason to split the fs/nls/nls_cp9??.c files), but
> (I will refrain from discussing drivers/scsi/advansys.c)

A simple set of code refactoring rules that I try to abide by:

1)  If a function is more than a few 25 or 40 line screens, it's likely
too big (unless a big switch statement or a list of initialization calls
or something).  If necessary, use static inline functions to factor out
repetitive behavior.

2)  If a file is more than 30-40 functions, it's likely too big, and you
should try to split it.  It's _ok_ to have 4 source files implementing
code for manipulating a single struct.

3)  If a normal line of code is more than 80 characters, one of the
following is probably true: you need to break the line up and use temps
for clarity, or your function is so big that you're tabbing over too
far.

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$ L++++(+ 
++) E
W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+ PGP+++ t+(+++) 5  
X R?
tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r  !y?(-)
------END GEEK CODE BLOCK------



  reply	other threads:[~2005-07-20  3:42 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-14  1:12 linux
2005-07-20  3:41 ` Kyle Moffett [this message]
2005-07-20  7:52   ` Jan Engelhardt
2005-07-21  0:45     ` Paul Jackson
2005-07-21  6:22       ` Jan Engelhardt
2005-07-21 16:57       ` Kyle Moffett
2005-07-21 18:42         ` Jesper Juhl
2005-07-21 19:37           ` linux-os (Dick Johnson)
2005-07-21 20:11             ` Jesper Juhl
2005-07-22  1:32               ` Jesper Juhl
2005-07-23  1:30                 ` Jesper Juhl
2005-07-22  2:29             ` Miles Bader
2005-07-22  3:47               ` Paul Jackson
     [not found] <4q0yr-4YQ-3@gated-at.bofh.it>
     [not found] ` <4sdKS-7Ko-9@gated-at.bofh.it>
     [not found]   ` <4shEU-25p-5@gated-at.bofh.it>
2005-07-20 17:42     ` Bodo Eggert
     [not found] <4p851-3Tl-11@gated-at.bofh.it>
     [not found] ` <4p8HK-4he-19@gated-at.bofh.it>
     [not found]   ` <4pmUD-7gx-37@gated-at.bofh.it>
2005-07-12 19:36     ` Bodo Eggert
2005-07-13  5:46       ` Denis Vlasenko
  -- strict thread matches above, loose matches on Subject: below --
2005-07-11 14:56 Michael S. Tsirkin
2005-07-11 15:34 ` Sander
2005-07-12  6:52   ` Denis Vlasenko
2005-07-12 11:55     ` Patrick McHardy
2005-07-12 12:17       ` Richard B. Johnson
2005-07-13  6:58         ` Paul Jackson
2005-07-13 17:22           ` Lee Revell
2005-07-13 17:52             ` Paul Jackson
2005-07-13 23:38             ` Marc Singer
2005-07-11 15:44 ` Dmitry Torokhov
2005-07-11 17:19   ` Ingo Oeser
2005-07-12  7:12 ` Denis Vlasenko
2005-07-12 11:36   ` Domen Puncer
2005-07-13  7:09 ` Paul Jackson
2005-07-20 12:59 ` Jesper Juhl
2005-07-20 13:07   ` Michael S. Tsirkin
2005-07-20 21:05   ` Paul Jackson
2005-07-20 22:37   ` Krzysztof Halasa
2005-07-22 17:12     ` Patrick Draper
2005-07-22 17:51       ` Jesper Juhl
2005-07-22 19:21       ` Sam Ravnborg
2005-07-22 20:28         ` Jesper Juhl
2005-07-21  0:20   ` Horst von Brand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FD559B50-FB1E-4478-ACF4-70E4DB7A0176@mac.com \
    --to=mrmacman_g4@mac.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®