Deutsch English Français Italiano |
<87ttft7bei.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson <Keith.S.Thompson+u@gmail.com> Newsgroups: comp.lang.c Subject: Re: how cast works? Date: Fri, 09 Aug 2024 12:18:29 -0700 Organization: None to speak of Lines: 33 Message-ID: <87ttft7bei.fsf@nosuchdomain.example.com> References: <v8vlo9$2oc1v$1@dont-email.me> <slrnvb7kis.28a.dan@djph.net> <v929ah$3u7l7$1@dont-email.me> <v92gt1$e1l$1@dont-email.me> <20240808193203.00006287@yahoo.com> <v92va5$4msg$1@dont-email.me> <v9310a$4v1a$2@dont-email.me> <v93565$6ffo$1@dont-email.me> <v93h12$9vom$1@dont-email.me> <87frre8v5q.fsf@nosuchdomain.example.com> <v95fcj$pv2g$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Fri, 09 Aug 2024 21:18:30 +0200 (CEST) Injection-Info: dont-email.me; posting-host="153d1bcdb0929153f62e0b2f2aa4005b"; logging-data="3835557"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jTFST9iwn+/wlJXNnFW3X" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:p1Mka5ksk25qyMkTJDUzFtFVxU0= sha1:NuvsZLWDSjdEW8/t5YIHzaD+YrM= Bytes: 2432 David Brown <david.brown@hesbynett.no> writes: > On 09/08/2024 01:14, Keith Thompson wrote: >> David Brown <david.brown@hesbynett.no> writes: >> [...] >>> A _Bool is always either 0 or 1. The conversion is whatever the >>> compiler needs to give an int of value 0 or 1. >> >> The value of a _Bool object is always either 0 or 1 *unless* the >> program does something weird. > > True. But attempting to use a _Bool object (as a _Bool) that does not > contain either 0 or 1 is going to be undefined behaviour (at least it > was on the platform where I saw this happen as a code bug). It depends on whether representations with non-zero padding bits are treated as trap representations (non-value representations in C23) or not. [...] >> It doesn't specify whether setting the padding bits to 1 results in a >> non-value representation. > > That's probably an implementation-defined issue, is it not? I'm not sure whether it's implementation-defined or unspecified. I don't see any mention of trap/non-value representations in Annex J. [...] -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */