asctime.c
Clive D.W. Feather
clive at demon.net
Tue Aug 3 09:19:26 UTC 2004
Robert Elz said:
> | Actually %.4d would be better.
As Paul points out, this breaks with negative numbers; %04d is better.
> You'd prefer years with leading zeroes? Why?
Because that's what "constant width" says to me.
> | This change could, in theory, break an existing program which relied on the
> | present specification.
> It could, but should there be any?
Why not? This started because you claimed programs were relying on the
previous specification.
> The mistake that was made here was
> in standardising asctime/ctime at all when strftime was all that was needed.
Possibly.
> | For some value of "portable". There's "portable to all Standard C
> | implementations" and "portable to both Standard and pre-Standard C".
> There's only one definition of "portable" that matters - if I code in
> this particular way, can I distribute my code and assume that it will
> work everywhere (here that means, everywhere there's a compiler that
> claims to compile C code).
I don't believe you can write any code that that statement is true for.
Clue: there are C compilers that don't implement printf().
> If my
> code fails on *any* implementations, it isn't portable.
I think you need to meet the real world. It doesn't work like that.
--
Clive D.W. Feather | Work: <clive at demon.net> | Tel: +44 20 8495 6138
Internet Expert | Home: <clive at davros.org> | Fax: +44 870 051 9937
Demon Internet | WWW: http://www.davros.org | Mobile: +44 7973 377646
Thus plc | |
More information about the tz
mailing list