lkml.org 
[lkml]   [2008]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] time: Fix constant size in kernel/timeconst.h
From
Date
H. Peter Anvin wrote:
> Johann Felix Soden wrote:
> > kernel/timeconst.pl generates only long sized constants in timeconst.pl
> > which gives this warning:
> >
> > kernel/time.c: In function 'msecs_to_jiffies':
> > kernel/time.c:472: warning: integer constant is too large for 'long' type
> >
> > unsigned long long is needed.
> Hm, you've just taken a warning and elevated it to a bug.
>
> According to the C standard, a constant has the shortest type (>= int)
> needed to hold the constant, and the warning above is somewhat bogus in
> that context (what version of gcc is that, anyway?)
>
> ULL is only appropriate to 32-bit machines, or there will be other
> issues downstream. The Right Way[TM] to do this would be to get Linux
> to have the [U]INTxx_C() macros from C99.
>
> -hpa

Sorry for this. Thanks for teaching about the C standard.
About your question: gcc 4.2.3 gave me this warning.
And I'm a little bit surprised because the kernel code is full of
constants with ULL. Is kernel/time.c a special case?

J. F. Soden




\
 
 \ /
  Last update: 2008-02-09 23:33    [W:0.036 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site