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

Larry McVoy
2003-06-01T14:56:33Z

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