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

Larry McVoy (lm@bitmover.com)
Sun, 1 Jun 2003 08:09:51 -0700


> /*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/