This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13080] clock() is unusable on 32-bit targets due to wrong type for clock_t


http://sourceware.org/bugzilla/show_bug.cgi?id=13080

--- Comment #4 from Rich Felker <bugdal at aerifal dot cx> 2011-08-31 12:25:31 UTC ---
Proposing that one "fix" strictly conforming ISO C applications to work around
a buggy implementation that won't be fixed for the sake of bug-compatibility
with existing binaries is a behavior I'd expect from major proprietary OS
vendors...

In any case, there's no such portable workaround anyway. To cast to an unsigned
type, you'd have to know *which* unsigned type to use. Using one that's too
large will break your app due to a large discontinuity at one of the points
where the high bit changes. You'd have to guess the corresponding unsigned
type, which is fairly easy on mainstream unix-like systems (it's going to be
uint32_t or uint64_t; just check the size) but impossible to do in a general,
portable way where your code would continue to work on exotic systems (there
may not even be an unsigned type with the same width due to padding bits).

Perhaps this could be fixed with symbol versioning or by having clock_t
conditionally defined correctly (#ifndef __cplusplus)? Obviously the latter
would not help C++ apps but at least the issue would be fixed for C.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]