bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash Coding style - Adopting C99 declarations


From: Andreas Schwab
Subject: Re: Bash Coding style - Adopting C99 declarations
Date: Sun, 28 Aug 2022 18:21:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1.91 (gnu/linux)

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.

Note that the next revision of the C standard removes support for K&R
declarations.

-- 
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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]