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: Tue, 03 Feb 2026 15:33:44 -0800 Organization: None to speak of Lines: 28 Message-ID: <87v7gdpfl3.fsf@example.invalid> References: <10jfol6$2u6r8$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> <10jpi8h$15aea$1@dont-email.me> <20260109141859.00004f22@yahoo.com> <10jv3rb$15aea$2@dont-email.me> <20260111132015.000026ad@yahoo.com> <86zf6kkjw0.fsf@linuxsc.com> <20260111235104.00001463@yahoo.com> <86ms1pj0bc.fsf@linuxsc.com> <87zf5pphwd.fsf@example.invalid> <10ltv1i$1svhi$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 03 Feb 2026 23:33:46 +0000 (UTC) Injection-Info: dont-email.me; posting-host="84306e1f977f13f562ce5f77da7c7ef4"; logging-data="1980658"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jNh1FPwrjZyfdOkZBhqda" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:fB2RZxFHjLF0f4DoPPoC6WE372s= sha1:xgmtG4j3I1rW4I6p5HDn6dS5DGA= Xref: csiph.com comp.lang.c:396582 Bart writes: > On 03/02/2026 22:43, Keith Thompson wrote: >> Tim Rentsch writes: >> [...] >>> If variable 'u' is declared as uint32_t, a way to print it that is >>> easy and also type-safe is >>> >>> printf( " u is %lu\n", u+0LU ); >> >> I prefer >> >> printf("u is %lu\n", (unsigned)long_u); >> >> I find it clearer. > > Is there a typo in there, or is the variable actually called 'long_u'? > Then the message doesn't match. Yes, that was a typo, a misplaced ')' (not sure how the '_' got there). Thanks for catching it. The version I prefer (and I tested it this time) is: printf("u is %lu\n", (unsigned long)u); -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */