Article View: comp.std.c
Article #5386Re: The type of time_t (was: struct tm -> time_t converter wanted)
From: Alan J Rosenthal
Date: Sun, 23 Oct 1988 17:38
Date: Sun, 23 Oct 1988 17:38
26 lines
1611 bytes
1611 bytes
karl@haddock.ima.isc.com (Karl Heuer) writes: >>There's nothing to prevent time_t from being typedef'd to unsigned long int, >>which would double the range... henry@utzoo.uucp (Henry Spencer) writes: >Unfortunately, it would probably break a significant number of programs that >think time_t is signed. Those programs are arguably broken already, but some >degree of pragmatism is necessary in such matters. Is it possible to assume that time_t is signed without assuming it's either int or long (or char)? I can't see how, and if it's not then Karl's change above wouldn't break any more programs than changing time_t between int and long would. (It is true that a cast to long sort of assumes that the value cast is signed, but in the case of time_t I don't see what you want to do with that value except cast it back to time_t, which makes the cast to long rather pointless. Or if you want to printf the number, well ansi printf's %lu format takes a long, not an unsigned long, anyway, so the cast to long is the correct way to print unsigned longs as well as longs.) ajr -- #define __STDC__ 0
Technical Details
Message-ID:
<8810231738.AA04205@explorer.dgp.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flapsReferences:
<442@grand.UUCP> <8700@smoke.BRL.MIL> <6964@cdis-1.uucp> <9816@haddock.ima.isc.com> <1988Oct22.230215.19411@utzoo.uucp>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps From: flaps@dgp.toronto.edu (Alan J Rosenthal) Subject: Re: The type of time_t (was: struct tm -> time_t converter wanted) Message-ID: <8810231738.AA04205@explorer.dgp.toronto.edu> Organization: University of Toronto References: <442@grand.UUCP> <8700@smoke.BRL.MIL> <6964@cdis-1.uucp> <9816@haddock.ima.isc.com> <1988Oct22.230215.19411@utzoo.uucp> Date: Sun, 23 Oct 88 13:38:52 EDT