lkml.org 
[lkml]   [2019]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] RDMA/siw: Fix compiler warnings on 32-bit due to u64/pointer abuse
Date
From: Joe Perches
> Sent: 27 August 2019 19:33
> On Tue, 2019-08-27 at 19:59 +0200, Geert Uytterhoeven wrote:
> > On Tue, Aug 27, 2019 at 7:46 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
> > > On Tue, Aug 27, 2019 at 07:29:52PM +0200, Geert Uytterhoeven wrote:
> > > > On Tue, Aug 27, 2019 at 4:17 PM David Laight <David.Laight@aculab.com> wrote:
> > > > > From: Geert Uytterhoeven
> > > > > > Sent: 19 August 2019 18:15
> > > > > ...
> > > > > > > I think a cast to unsigned long is rather more common.
> > > > > > >
> > > > > > > uintptr_t is used ~1300 times in the kernel.
> > > > > > > I believe a cast to unsigned long is much more common.
>
> btw: apparently that's not true.
>
> This grep may be incomplete but it seems there are fewer
> kernel uses of a cast to unsigned long then pointer:
>
> $ git grep -P '\(\s*\w+(\s+\w+){0,3}(\s*\*)+\s*\)\s*\(\s*unsigned\s+long\s*\)'|wc -l
> 423
>
> Maybe add a cast_to_ptr macro like
>
> #define cast_to_ptr(type, val) ((type)(uintptr_t)(val))
>
> though that may not save any horizontal space

And it is another bit of pointless obfuscation....

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

\
 
 \ /
  Last update: 2019-08-28 10:28    [W:0.054 / U:0.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site