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

Steven Cole
2003-06-01T17:05:39Z

On Sun, 2003-06-01 at 10:52, Larry McVoy wrote:
> > Thanks for the input. You've convinced me. When going through
> > arch/ppc/xmon/xmon.c, I will leave things like the following unchanged:
> >
> > /* Command interpreting routine */
> > static int
> > cmds(struct pt_regs *excp)
> > {
>
> Great.
>
> > My changes will be similar to the following:
> >
> > @@ -1837,9 +1818,7 @@
> > return *lineptr++;
> > }
> >
> > -void
> > -take_input(str)
> > -char *str;
> > +void take_input(char *str)
> > {
> > lineptr = str;
> > }
>
> OK, I'm confused. You said you were convinced but then shouldn't that be
>
> void
> take_input(char *str)
> {
> lineptr = str;
> }
>
> ??
Yeah, I realized the inconsistency of that after sending. This is with
that change backed out (same as your example above):

@@ -1838,8 +1819,7 @@
}

void
-take_input(str)
-char *str;
+take_input(char *str)
{
lineptr = str;
}

My guiding principle in all this is "first, do no harm". That's why I
posted my question in the first place. Thanks for the help.

Steven