Strftime's %C and %y formats versus wide-ranging tm_year values

Ken Pizzini tz. at explicate.org
Fri Sep 24 20:19:49 UTC 2004


On Fri, Sep 24, 2004 at 12:20:35PM -0700, Paul Eggert wrote:
> Ken Pizzini <"tz."@explicate.org> writes:
> > The C language definition has typically left as "implementation defined"
> > whether the result of (-42)%100 is -42 or +58
> 
> That was true for C89, but it's not true for C99, which standardized
> on "Fortran" integer division, so that (-42)%100 is -42 and (-42)/100
> is 0.
> 
> It may be worth recording for older C89 systems that don't implement
> Fortran division, not that I know of any; but for newer systems we can
> rely on the Fortran model.

Yes, but it was true from the earliest K&R days until C99,
and the rest of the code certainly caters to all manner of
non-C99 implementations.  If we are willing to accept C99
guarantees, there is a lot of code simplification that could
be made.  (Besides, IMHO C99 is philosophically wrong on this. ;-)

		--Ken Pizzini



More information about the tz mailing list