Eric Blake wrote: > "The results are unspecified ... or if a minimum field width is > specified for any conversion specifier other than C , F , G , or Y ." > > So I guess the gcc warning is nice if you are being portable to non-GNU > strftime
And also with GNU strftime, the width feature is useless here: %5b will ensure that the result occupies 5 _bytes_, not 5 screen columns. POSIX says: "If the converted value ... has fewer bytes than the minimum field width ... the output shall be padded ..." Bytes and columns are a different thing. For example, in a German UTF-8 locale, "Mär" is 4 bytes but only 3 screen column. Likewise for "fév" in a French UTF-8 locale. Test program: ================================================= #include <stdio.h> #include <locale.h> #include <time.h> int main() { setlocale (LC_ALL, ""); char buf[100]; time_t now = time (NULL); strftime (buf, 100, "%5b", localtime (&now)); printf ("|%s|\n", buf); return 0; } ================================================= $ LC_ALL=fr_FR.UTF-8 ./a.out | mars| $ LC_ALL=de_DE.UTF-8 ./a.out | Mär| You can see that for column alignment purposes, it is useless. Bruno _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils