bug-bash
[Top][All Lists]
Advanced

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

Re: compiler warnings


From: Chet Ramey
Subject: Re: compiler warnings
Date: Tue, 8 Mar 2005 10:31:15 -0500

> When compiling bash with GCC there are a number of alarming-looking
> warnings, and several of them could be avoided by minor changes to the
> code.  For example:
> 
> bashline.c:2976: warning: suggest parentheses around assignment used
> as truth value
> 
>   for (passc = 0; c = string[i]; i++)
> 
> This could more readably be written:
> 
>   for (passc = 0; (c = string[i]) != '\0'; i++)
> 
> Would you be willing to accept patches to make changes such as this?

No, the former is my preferred style.  The latter is less readable and
reduces clarity.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@case.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

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