> If all Y2K code could be accurately and readily identified, how difficult
> would it be to develop an automated tool that would correct all Y2K errors
> with either century windows or four digit year expansion?
Have a go at this one:
days = (!(year|3) && year) ? 29 : 28;
Is the year 2 or 4 digit?
Assuming it is 2 (the code makes no sense otherwise), how do propose to
fix the algorithm (the error has nothing to do with the year
I don't think an automated process could answer the first question. The
second question would not even be asked.
Let's try another:
display.year = year % 100;
t.tm_year = year % 100;
How is this process to know that the first is fixed by:
display.year = year;
and the second is fixed by:
t.tm_year = year - 1900;
In short, you have to have an intelligent set of eyes looking at these
pieces of code. An automated process could easily leave these examples
in worse shape than they started. Incidentally, if you think these
examples are contrived, it's time you started reviewing some code.
Comsys Millenium Services
eMail: remove NoSpam from above
Standard disclaimer - I speak for myself and nobody else.