lkml.org 
[lkml]   [2010]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/45] kstrtox: converting strings to integers done (hopefully) right
On Tue, Dec 07, 2010 at 10:45:33AM +0100, Arnd Bergmann wrote:
> On Tuesday 07 December 2010 10:32:29 Alexey Dobriyan wrote:
> > On Tue, Dec 07, 2010 at 10:04:58AM +0100, Arnd Bergmann wrote:
> > > On Monday 06 December 2010 16:16:36 Alexey Dobriyan wrote:
> > >
> > > > It is used by kstrtol() if "long" and "long long" aren't the same type.
> > > > I can't ifdef it because gcc doesn't allow "#if sizeof(long long) == ".
> > > > "Do not use" hints "use kstrtol()".
> > >
> > > Can't you use #ifdef CONFIG_64BIT to see if long is 64 bit wide?
> >
> > I could, but there are no defines for alignment.
>
> Not sure what you mean here.

One can't write:

#if sizeof(long) == sizeof(long long) && alignof(long) == alignof(long long)

and there are no _ALIGNOF_LONG or something like that.

> All architectures always naturally align 'long' variables --
> we rely on that elsewhere already. 'long long' is misaligned on x86-32 and
> possibly some other 32 bit architectures, but since that should not cause
> any problems.

The point is that code as written doesn't care and correct wrt alignment.

> Another option would be to export just the strto{u,s}{8,16,32,64}
> functions and define the inline wrappers conditionally on CONFIG_64BIT.

This means more ifdefs. Maybe someone could ifdeflessly fix this later.


\
 
 \ /
  Last update: 2010-12-08 09:55    [W:0.812 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site