[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash Coding style - Adopting C99 declarations
From: |
Dmitry Goncharov |
Subject: |
Re: Bash Coding style - Adopting C99 declarations |
Date: |
Sun, 28 Aug 2022 19:14:44 -0400 |
On Sunday, August 28, 2022, Andreas Schwab <schwab@linux-m68k.org> wrote:
> On Aug 28 2022, Greg Wooledge wrote:
>
> > On Sun, Aug 28, 2022 at 10:47:38AM -0400, Yair Lenga wrote:
> >> Hi,
> >>
> >> I've noticed Bash code uses "old-style" C89 declarations:
> >> * Parameters are separated from the prototype
> >> * Variables declared only at the beginning of the function
> >> * No mixed declaration/statements
> >> * No block local variables
> >>
> >> intmax_t
> >> evalexp (expr, flags, validp)
> >> char *expr;
> >> int flags;
> >> int *validp;
> >> {
> >> intmax_t val;
> >> int c;
> >> procenv_t oevalbuf;
> >>
> >> val = 0;
> >> noeval = 0;
> >> already_expanded = (flags&EXP_EXPANDED);
> >
> > You're mistaken. What you're seeing is the "K&R" coding style, which
> > predates C89.
This was not really a coding style. This was the c language syntax of
defining parameters.
>
> Note that the next revision of the C standard removes support for K&R
> declarations
> The code will continue to compile, won't it?
Regards, Dmitry
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
>
>