Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: printf and time_t Date: Wed, 07 Jan 2026 17:36:34 -0800 Organization: None to speak of Lines: 57 Message-ID: <877btshom5.fsf@example.invalid> References: <10jfol6$2u6r8$1@news.xmission.com> <10jfs23$2liif$1@dont-email.me> <20260105105138.00005f0a@yahoo.com> <10jgbp7$2vdjt$1@news.xmission.com> <10jgdu9$2t8dh$1@nntp.eternal-september.org> <10jhkso$3c9r2$3@nntp.eternal-september.org> <20260106112938.00004446@yahoo.com> <10jj9st$3jbe4$2@dont-email.me> <20260106200522.000015ea@yahoo.com> <87h5sy2rlb.fsf@example.invalid> <87qzs1gliq.fsf@example.invalid> <20260108012620.000041a9@yahoo.com> <87bjj5gei4.fsf@example.invalid> <20260108023846.0000260c@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Thu, 08 Jan 2026 01:36:35 +0000 (UTC) Injection-Info: dont-email.me; posting-host="8f3ae4e77d372175ded3df1f10d77444"; logging-data="1196676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MW2RWOfeNVVvMicpUkbDf" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:0OOYIassQjGkgmB//fPqkrq8wPY= sha1:gIVF1yugCdOD8hK2ZyRuZuAd7g4= Xref: csiph.com comp.lang.c:396289 Michael S writes: > On Wed, 07 Jan 2026 16:00:19 -0800 > Keith Thompson wrote: >> Michael S writes: >> > On Wed, 07 Jan 2026 13:28:45 -0800 [...] >> >> Michael, if you'd care to clarify, given: >> >> >> >> unsigned long n = 42; >> >> printf("%u\n", n); // incorrect >> >> printf("%lu\n", n); // correct >> >> >> >> (and assuming that unsigned int and unsigned long are the same >> >> width on the current implementation), do you really prefer the >> >> version marked as "incorrect"? >> > >> > I hoped that I already clarified that point more than one time. >> > Obviously, I hoped wrong. >> >> And you still haven't. I asked a specific question above. What is >> your answer? Would you use a "%u" format to print a value that's >> defined with type unsigned long? I inferred from what you wrote >> that your answer would be yes. If your answer is no, I'll gladly >> accept that. (And if so, what you wrote previously was unclear, >> but I'm not going to worry about that if you clarify what you meant) > > When n declared as 'unsigned long' derectly rather than via unint32_t > alias than the answer is 'no'. Thank you for answering that. >> You've previously indicated that you find "%lu" uglier than "%u", >> and that that's relevant to which one you would use. Do you still >> think so? >> >> I would appreciate direct yes or no answers to both of those >> questions. > > It depends on how n declared. > When it declared as 'unsigned long' then "lu" is not uglier. > When it is defined as uint32_t it is uglier, despite the fact that on > absolute majority of the targets that I care about the latter is an > alias of the former. Let me see if I understand you correctly. uint32_t n = 42; printf("%u\n", n); printf("%lu\n", n); In this context, you find "%lu" uglier than "%u"? [SNIP] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */