This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

Re: warning: `%y' yields only last 2 digits of year


<<Which is still wrong since years can span more than just 1900 - 2099.
What's wrong with using %Y in the first place?

Andreas.
>>

You missed my point entirely, probably from not being aware of the Y2K
issues and solutions.

A common technique for dealing with the Y2K problem, in cases where it is
impractical to modify data structures or databases, is to use what is usually
called windowing.

For instance an insurance company may know that it did not exist before
1982, so any date in the range 82-99 is 1982-1999, and any date in the
range 00-81 is 2000-2081. This would of course be suitable only for
policy inception dates, not for client birthdates, but for the inception
date use, this can keep them going another 80 years, which may be plenty
(if for example they anticipate a complete system rewrite before 2080).

It was *specifically* for that common technique that I gave my example, and
the suggestion of using %Y is irrelevant.

Once again, please don't assume you know better than the applications
programmer what the *applications* requirements are. Warnings in languages
should be about supposing that you know enough about the *language* in
which the application is being written to identify constructs that are
suspicious at the language level.


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