Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 13 Feb 2002 05:58:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 13 Feb 2002 05:58:20 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.31.123]:10503 "EHLO atrey.karlin.mff.cuni.cz") by vger.kernel.org with ESMTP id ; Wed, 13 Feb 2002 05:57:03 -0500 Date: Wed, 13 Feb 2002 11:56:25 +0100 From: Pavel Machek To: Andre Hedrick Cc: Martin Dalecki , Vojtech Pavlik , Pavel Machek , Jens Axboe , kernel list Subject: Re: another IDE cleanup: kill duplicated code Message-ID: <20020213105625.GI32687@atrey.karlin.mff.cuni.cz> In-Reply-To: <3C6A418A.8040105@evision-ventures.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.24i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi! > > Well, after looking at yours code close engough I have one advice for > > you as well: LEARN C. > > I specialize in storage, and C is self taught. Okay, few things to keep in mind: *) cut-copy-paste is bad. If you fix error in one copy, it is _very_ easy not to fix it in other copies. *) void *'s and casts are bad. They hide real errors. If you have struct foo {} bar; and want bar * baz; later; You can write it as struct foo * baz. That will make type checks actually work and save you lot of casts. *) hungarian notation is considered evil in kernel. struct bla_s {} bla_t; *is* evil -- why have two types when one is enough? In kernel land, right way is to do struct bla {}; and then use "struct bla" everywhere you'd use bla_t. It might be slightly longer, but it helps you with casts (above) and everyone can see what is going on. Pavel -- Casualities in World Trade Center: ~3k dead inside the building, cryptography in U.S.A. and free speech in Czech Republic. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/