Re: Question about style when converting from K&R to ANSI C.

From: Larry McVoy (lm@bitmover.com)
Date: Sun Jun 01 2003 - 10:09:51 EST


> /*ARGSUSED*/
> -static unsigned long
> -insert_bba (insn, value, errmsg)
> - unsigned long insn;
> - long value;
> - const char **errmsg;
> +static unsigned long insert_bba(
> + unsigned long insn,
> + long value,
> + const char **errmsg
> +)
> {
> return insn | (((insn >> 16) & 0x1f) << 11);
> }

Of the following, the original is clearly outdated so we can all agree that
can go. I'm not real found of Linus' style either. What's wrong with the
two traditional forms?

/* ============== original ============== */
static unsigned long
insert_bba (insn, value, errmsg)
        unsigned long insn;
        long value;
        const char **errmsg;
{
        return insn | (((insn >> 16) & 0x1f) << 11);
}

/* ============== linus ============== */
static unsigned long insert_bba(
        unsigned long insn;
        long value;
        const char **errmsg;
)
{
        return insn | (((insn >> 16) & 0x1f) << 11);
}

/* ============== traditional ============== */
static unsigned long
insert_bba(unsigned long insn; long value; const char **errmsg)
{
        return insn | (((insn >> 16) & 0x1f) << 11);
}

/* ============== traditional (lotso args) ============== */
static unsigned long
insert_bba(
        register unsigned const int some_big_fat_variable_name;
        unsigned long insn;
        long value;
        const char **errmsg)
{
        return insn | (((insn >> 16) & 0x1f) << 11);
}

-- 
---
Larry McVoy              lm at bitmover.com          http://www.bitmover.com/lm
-
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 : Sat Jun 07 2003 - 22:00:14 EST