Re: another IDE cleanup: kill duplicated code

From: Pavel Machek (pavel@suse.cz)
Date: Wed Feb 13 2002 - 05:56:25 EST


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/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:00:53 EST