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: Fri, 09 Jan 2026 11:27:34 -0800 Organization: None to speak of Lines: 42 Message-ID: <87pl7ioac9.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> <10jpi8h$15aea$1@dont-email.me> <20260109141859.00004f22@yahoo.com> <10jqthf$2c0jh$1@dont-email.me> <0576c5c443c60da7c60774b669ce965bc9774078.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 09 Jan 2026 19:27:35 +0000 (UTC) Injection-Info: dont-email.me; posting-host="acddbd2710fffc9599b4649dda7a064b"; logging-data="2751083"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ytRIk4lgcY7gHEbNk1bJW" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:dUVuuGq1EBCZIbv1VCxH8l40DBg= sha1:X1mf+uriBero77amcJvsegOk6UE= Xref: csiph.com comp.lang.c:396327 wij writes: > On Fri, 2026-01-09 at 13:49 +0100, David Brown wrote: [...] >> I have a lot of trouble understanding why you would go out of your way >> to knowingly write incorrect code - prioritising tiny, irrelevant >> savings in source code space over correct, guaranteed, portable code >> that can be automatically checked by tools. > > Snipet from ClassGuidelines.txt > ... > wrd(or notation) > This function converts the argument object (a type, class,..) to text [SNIP] > My reply might not be directly in the topic of current post. Just jumpped in > to reply. Huh?? "ClassGuideline.txt" (which I managed to find on Sourceforge) is a set of guidelines for C++ programming, apparently something you wrote. As far as I can tell, it has nothing to do with the current discussion or with the topic of this newsgroup. Why did you mention it here? > It looks to me the format character MUST match the type passed to  > printf, otherwise UB. It doesn't just look to you that way. The C standard says so explicitly. C17 and earlier says "If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined." C23 changed the wording, saying that fprintf shall behave as if it uses va_arg; the description of va_arg says the behavior is undefined if the wrong type is used. Note that the description of va_arg allows, for example, using unsigned int for an argument of type int or vice versa *if* the value is within the range of both. If it had been the intent to allow incompatible types that happen to have the same size and representation, the standard would have said so. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */