From owner-freebsd-hackers@freebsd.org Fri Jan 15 20:57:27 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B0A04F2D8E for ; Fri, 15 Jan 2021 20:57:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-21.consmr.mail.gq1.yahoo.com (sonic309-21.consmr.mail.gq1.yahoo.com [98.137.65.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DHYQs3nV2z3pvP for ; Fri, 15 Jan 2021 20:57:25 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1610744243; bh=VM36DrVieqsPVppApsAm5S4bZ4OkW3L54o6344iKA3t=; h=Subject:From:Date:To:From:Subject:Reply-To; b=dxDdzS3yvZ744fU3nE7S7j+MlbC48SdhhHgb+TvmNhvUnU/ix3HBHn2ngZS1C97IY5uIAlP3QHswBQgmDq6ojtFDOTovBVXOToZBWOe/htbu2go6WAfGgcGMd8tkHNoDy+Xlo1ekSuwRpJCIUrOykZkJMTXhMdqOx5+A9NqsFAxMIWACepPxLHrRp/KslYi7KhrSRoaGF1LJesWx0yn9ZZdpIS/TMkECQoxVdPEREomBgxu49zY6YVW6OT7l3sQ8yUtmwLRU+IF7LW1FaFIBGULwZCqoAMlJOH5sneC8ZvFU3f1XBAFyWqyyETyBsfmtBxd0PmfTUa5DiBQQnpAURQ== X-YMail-OSG: P7ZBQBUVM1n44yuOJ.Ql2ZWqkKdFIgtrCcNY7AJDnUpb7Tu2msNzRcI6pughZaS SajepQskolgGL7ZAmzbUCupfHvo_qd7AT90ZOvNeEAcQzwAIcw8yIeEnzsihDyLPMB1BNhnT6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B9rtO IGx3z.4FYH8UdPV7Us7aZLpj.vZjuB952.YEgIs3DS65oDRMC2oFm7aGjMr2YL4Cj1OGkjJDpiwj oiWcc.wjf0YBa1Kkf8X6f4sInSjC5r4afjUzM0a5ELkjAZCt8nkLhqOilFDipLHCxolFYtT0p5ZE jTMxKtyQwJhK_3A9MTSzFJucAFow6UNu5X.J0onNW.eVJhKvStcmU_t7suJ1i_xrk8448_2.ZsCc BMDclGWIF1Cf0um4ia8x7BVxKU3siUggKBHt7x9OFEwGaF_Q- Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Fri, 15 Jan 2021 20:57:23 +0000 Received: by smtp403.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID ebb494291fcb57c7589b53b35fc81ff5; Fri, 15 Jan 2021 20:57:17 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: Implicit assumptions (was: Re: Some fun with -O2) From: Mark Millard In-Reply-To: <8830694.EFs4ROYVHJ@t450s.local.lan> Date: Fri, 15 Jan 2021 12:57:14 -0800 Cc: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <4E90FC92-D255-4082-9F89-2BEE4D4C4E92@yahoo.com> References: <2310709.D6tDg3Ca2R@t450s.local.lan> <8830694.EFs4ROYVHJ@t450s.local.lan> To: Walter von Entferndt X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Rspamd-Queue-Id: 4DHYQs3nV2z3pvP X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.65.147:from]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[98.137.65.147:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.147:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.65.147:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2021 20:57:27 -0000 On 2021-Jan-15, at 11:22, Walter von Entferndt = wrote: > At Freitag, 15. Januar 2021, 19:35:40 CET Mark Millard wrote: >> Have you read a (fairly modern) C standard or its officially >> published rationle? You might want to. >>=20 > Honestly, no. The price to download the official standard PDF from = https:// > www.iso.org/standard/74528.html is ~200 CHF. If you can send me a = link to=20 > download a copy, I'd be thankful. The rationale vintage that I have a copy of is available at: http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10.pdf The rationale is normally a better starting point than the standard for guiding understanding of the standard --but is not normative. What makes the rationale a matter starting point for interpreting the standard is that, while the standard should have the more overall properties documented in the rationale, one has to infer various properties from more detailed rules that were designed to have the properties (and may be better at covering limiting conditions than the more overall rationale material). But the rationale can not be used to answer all questions. As for drafts of vintages of the standard: http://www.open-std.org/jtc1/sc22/wg14/www/projects#9899 has links (the first 4 N???? links) to final drafts (or very-early next-standard drafts) of the standards for C2x, C17, C11, and C99. My understanding is that C17 mostly dealt with clarification requests, other than the ATOMIC_VAR_INIT one leading to depreciating ATOMIC_VAR_INIT instead. As I understand, FreeBSD basically targets C99 (possibly without things made optional or depreciated in C11 or later: future compatibility biased). > Any other good reference manual either in=20 > PDF or HTML (tarball or thelike) would also be fine. I showed my = source=20 > (https://code-reference.com/c/) which I quickly looked up on the net. >=20 >> =46rom the officially published C99 rationale (page labeled 11, >> Terms and definitions): >>=20 >> QUOTE >> ) All objects in C must be representable as a contiguous sequence of = bytes, >> each of which is at least 8 bits wide. >>=20 >> ) A char whether signed or unsigned, occupies exactly one byte. >>=20 > That means it does not make any difference to use either NBBY or = CHAR_BIT? =20 > Maybe CHAR_BIT is preferable, because it is C standard (guaranteed to = exist on=20 > all platforms), whereas NBBY is not since it's in include/sys? I'd say that using C's CHAR_BIT means less variation in the code from = system to system and less knowledge of system specifics required. So in code = not intended to be system specific, CHAR_BIT would be preferred. That does = not cover code intended to be system specific. > Beside that, can you affirm the fix I suggested is correct & portable? Before I could make any grand overall claim about the code, I'll need to take time to think about all of it, instead of just reporting things that I happen to quickly notice while scanning the exchange. I may get to this, but I'm not sure when. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)