[lkml]   [2010]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] [4/23] pagemap: Avoid unused-but-set variable
> urgh.  In fact I'd urgh the whole patchset.
> Problem is, anyone who looks at all these random (void) casts is going

There are actually not that many in the patch kit if you read it
completely. I think that's nearly the only one outside a macro.

> to have a hard time working out why they're there. This is worsened by
> the long-standing practice wherein some people put unneeded (void) casts all
> over the place due to being traumatised by lint 15 years ago (I think).

It's really the same reason why they used this with lints.

When I tried it first I started complaining about gcc too (I even
filled a gcc bug), then disabled it in my build,
but after some contemplation I found it really finds real bugs.

> Wouldn't it be better to make this stuff self-documenting, so anyone
> who reads the code can immediately see what it's doing, rather than
> scratching their heads over random, seemingly-unneeded casts?
> #define gcc_46_is_a_pita(expr) ((void)(expr))

The warning is really useful and we'll get all used to it.

So I went with the plain cast. Maybe some more comments would
be useful.


-- -- Speaking for myself only.

 \ /
  Last update: 2010-06-19 09:47    [W:0.052 / U:33.624 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site