This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: RFC: Walways-true considered harmful
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Rask Ingemann Lambertsen'" <rask at sygehus dot dk>, 'Manuel López-Ibáñez' <lopezibanez at gmail dot com>
- Cc: "'gcc'" <gcc at gcc dot gnu dot org>
- Date: Sat, 13 Jan 2007 13:59:34 -0000
- Subject: RE: RFC: Walways-true considered harmful
On 13 January 2007 12:55, Rask Ingemann Lambertsen wrote:
> On Sat, Jan 13, 2007 at 04:08:18AM +0000, Manuel López-Ibáñez wrote:
>
>> Much later, the warning was given a name, Walways-true [3], since the
>> warning message said explicitly that something will always be true.
>> However, Andrew Morton didn't want to get a warning just because the
>> expression was always true. He wanted to be warned of using the
>> address of a function where it makes more sense to call the function.
>
> Also, while it will be good to warn about
>
> if (func)
> {
> ...
> }
>
> it'll be bad to warn about
>
> if (timerstruct->callbackfunc)
> {
> ...
> timerstruct->callbackfunc (...);
> ...
> }
>
And equally bad to warn about
> if (func)
> {
> ...
func (...);
> ...
> }
Did you mean to limit it specifically to struct members?
cheers,
DaveK
--
Can't think of a witty .sigline today....