Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: How About Disallowing Assignments In Expressions? Date: Sat, 10 Feb 2024 18:00:57 -0800 Organization: None to speak of Lines: 37 Message-ID: <87il2vbvza.fsf@nosuchdomain.example.com> References: <87r0hlef8q.fsf@nosuchdomain.example.com> <87sf20o4e2.fsf@bsb.me.uk> <8734tzoli4.fsf@bsb.me.uk> <87v86vbx6s.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: dont-email.me; posting-host="a3ea5551d1916ca86f611a52355c117b"; logging-data="140583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19l3PcSZCi/tk35QwNKBLzL" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:QsToecqG+IoL03LVT5zQfjPPwss= sha1:jyo0A54Mcii0P1xiJ8/NauYPTeo= Xref: csiph.com comp.lang.c:382305 Lawrence D'Oliveiro writes: > On Sat, 10 Feb 2024 17:34:51 -0800, Keith Thompson wrote: >> Lawrence D'Oliveiro writes: >>> On Sun, 11 Feb 2024 01:08:51 +0000, Ben Bacarisse wrote: [...] >>>> The type of c == d is int, but the value will be either 0 or 1. >>> >>> That is the only kind of “boolean” C has. >> >> No it isn't. C99 added _Bool, which can be called bool if you include >> . C23 (not yet released) will make bool a keyword, with >> _Bool as an alternative spelling. >> >> But the equality and relational operators still yield results of type >> int with value 0 or 1. > > All just new, different names for what I said: still the only kind of > “boolean” C has. I can imagine that you're trying to express something that's correct, but I honestly have no idea what it might be. C has a boolean type, called "_Bool" or "bool", added in C99. _Bool is a distinct type, not the same as or compatible with any other type. Equality and relational operators yield results of type int, not _Bool. An expression of any scalar type (which includes integer, floating-point, and pointer types) can be used as a condition. Assuming you agree with all that, I have no idea what you mean by "the only kind of “boolean” C has". -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Medtronic void Void(void) { Void(); } /* The recursive call of the void */