Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: C23 (C2x) changes Date: Sat, 02 Oct 2021 07:16:19 -0700 Organization: A noiseless patient Spider Lines: 26 Message-ID: <86pmsnsea4.fsf@linuxsc.com> References: <%b82J.66798$VZ1.3585@fx08.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="394007ef4ff0447a8819fcdafe9c3245"; logging-data="4433"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OLV3q2SRtnLEFyPI2VpRC0xLDQE0WaHM=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:mS+uxaqibMRavhIcfLkC8mF+X88= sha1:0ClHR8eXW/FOE7QMNHh2TZ/STDA= Xref: csiph.com comp.lang.c:162936 scott@slp53.sl.home (Scott Lurndal) writes: > Bart writes: > >> [...] >> >> Try this program, where the number of applies is represented with >> an 8-bit value: >> >> int8_t apples; >> >> apples = 127; >> printf("Initial pile of apples: %d\n",apples); > > if (apples < CHAR_MAX) { > >> apples += 1; > > } else { > panic("Logic error by the unqualified C programmer\n"); > } > > fixed it for you. if (apples < SCHAR_MAX) {