This is the mail archive of the gcc-prs@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: c/3190: Re: gcc bug: complaint on %c for strftime


The following reply was made to PR c/3190; it has been noted by GNATS.

From: Pavel Roskin <proski@gnu.org>
To: "Joseph S. Myers" <jsm28@cam.ac.uk>
Cc: Neil Booth <neil@daikokuya.co.uk>, "" <Andries.Brouwer@cwi.nl>, 
    "" <gcc@gcc.gnu.org>, "" <gcc-gnats@gcc.gnu.org>
Subject: Re: c/3190: Re: gcc bug: complaint on %c for strftime
Date: Tue, 26 Nov 2002 16:22:24 -0500 (EST)

 > (b) I'll predict now that if GCC and C-based languages with strftime are
 > still in use in the 2090s,
 
 Agreed
 
 > people then will be cursing anyone who now removes Y2K (and Y2.1K)
 > warnings for -Wall, assisting in proliferation of bad code, unless by
 > then there have been major improvements through other methods in the
 > ability to write correct code.
 
 Such methods do exist (windowing), and they are used already.
 
 I agree that unconditional stripping most significant part of the year in
 the format is wrong and should be discouraged.
 
 On the other hand, I don't want to be warned about doing the right thing
 and using the user-preferred format when giving information to the end
 users, just because people in some country use two-digit years (e.g. the
 age of their emperor).  It's not my problem.  It may (or may not) be a
 problem of that country.
 
 > (c) A simple conservative change would be to move -Wformat-y2k out of
 > -Wformat (into -Wformat=2 alongside -Wformat-nonliteral and
 > -Wformat-security; -Wformat-security being another option I think would
 > fit the definition of -Wall).  But see (b) about people in 90 years' time
 > cursing such a change.
 
 I have no problem with warnings about modifiers like %y and %D, even as
 part of -Wall.
 
 On the other hand, I believe that the warning about %c (as well as %x and
 some other locale-specific formats) is invalid and should be eliminated
 completely.  %c uses locale-specific format by definition.  If that's
 considered a problem, let's also warn that the months can be printed in a
 foreign language, or that the day can be printed before the month.
 
 Date formatted by %c is not meant to be parsed back to the machine
 readable form.  Pretending that it is could encourage bad programming.
 
 -- 
 Regards,
 Pavel Roskin


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