Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Expression statements (was Re: Meaning of "expression")
Date: Wed, 19 Aug 2026 08:32:09 -0700
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <86ecfu15za.fsf@linuxsc.com>
References: <10v7b32$2u85v$1@dont-email.me> <86ecipcbqa.fsf@linuxsc.com> <10vnlgu$382un$2@kst.eternal-september.org> <86bjdpayv0.fsf@linuxsc.com> <10vv49k$1aoa2$4@kst.eternal-september.org> <1107aq2$3grso$2@kst.eternal-september.org> <11093p9$1nauc$1@dont-email.me> <11095su$1obc$1@dont-email.me> <110981v$1nauc$2@dont-email.me> <1109ai6$1aa$1@dont-email.me> <110a4cv$b2kq$4@kst.eternal-september.org> <110etqg$1naub$9@dont-email.me> <110f1c5$1ltqf$1@dont-email.me> <110fdaf$1naub$11@dont-email.me> <110fkk2$1qf9f$2@kst.eternal-september.org> <111pr2q$5rbd$1@dont-email.me> <111q697$3cgp8$1@kst.eternal-september.org> <86qzlq7gkr.fsf@linuxsc.com> <111shoe$3vq40$3@kst.eternal-september.org> <86wlts5tbr.fsf@linuxsc.com> <115o0en$2rq0k$2@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Wed, 19 Aug 2026 15:32:10 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="2905177"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wI9LHDZp+3mrO7H2JfFa54ye8O4oOMSA="; posting-host="d6f68e827472d35b9db1fc199aad88a7"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:NpBUXcyeoHtkV2uANTCcLvWZcY8= sha1:GHpNXOgnL/8RxvJsyPwayL3ycR8= sha256:14P2jtnVmtq2IdEltitLklmeSCO1JTH0eYV45Djar04= sha1:F6axFav08dbuvDQeVmVCSb9kGcU= sha256:HrhZp9qEMdCEjV1zlVlNHymIi4n94MZXwWPqBGABCqU=
Xref: csiph.com comp.lang.c:401328
Keith Thompson writes:
> Tim Rentsch writes:
>
>> Keith Thompson writes:
>>
>>> Tim Rentsch writes:
>>>
>>>> Keith Thompson writes:
>>>
>>> [...]
>>>
>>>>> For example, this program:
>>>>>
>>>>> #include
>>>>> int main(void) {
>>>>> const int result = printf("%ld\n", 0.3);
>>>>> printf("printf returned %d\n", result);
>>>>> }
>>>>>
>>>>> on my system prints:
>>>>>
>>>>> 140732048673560
>>>>> printf returned 16
>>>>>
>>>>> gcc and clang warn about the format string. tcc doesn't.
>>>>>
>>>>> The (first) printf call was apparently successful because printf
>>>>> has no way to know that the argument was of an incorrect type
>>>>> (types don't really exist at run time).
>>>>
>>>> printf() could know if an argument were of an incorrect type, if
>>>> an implementation chose to do so.
>>>
>>> Sure. I did write "on my system", where printf has no way to know
>>> that the argument was of an incorrect type.
>>
>> The "on my system" applies to what the program prints.
>>
>> The paragraph that says "printf has no way to know" is a general
>> statement, for any implementation of printf(). If you had meant it
>> to apply only to your system, you should have said something like
>> "because that printf had no way to know". Without any qualifying
>> adjective or other indicator the statement is generic, not
>> specific.
>
> [...] Certainly printf has no way defined by the language to know
> whether its arguments are of the correct types. An implementation
> could provide that information via some system-specific method,
> [...]
I'm glad to know we are in agreement.