lkml.org 
[lkml]   [2012]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: PATCH [3/n]: Add __snseconds_t and __SNSECONDS_T_TYPE
From
On Thu, Mar 15, 2012 at 3:05 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 03/15/2012 01:57 PM, H.J. Lu wrote:
>> What is the real consequence of using long long on tv_nsec,
>> except for not POSIX compliant? Will it lead to wrong code?
>
> It would break applications that do anything like this:
>
>  struct timespec t;
>  long *p = &t->tv_nsec;
>
> Such applications work fine now and conform to POSIX, but would

GCC will complain about "incompatible pointer type".

> either not compile or (worse) might compile and do the
> wrong thing, if tv_nsec were wider than 'long'.

We had a discussion on Linux kernel mailing list:

https://lkml.org/lkml/2012/2/8/408

We thought it was OK to have long long on tv_nsec.

--
H.J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-03-15 23:21    [W:0.172 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site