From owner-freebsd-hackers@freebsd.org Fri Jan 15 18:35:50 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 44A464EE812 for ; Fri, 15 Jan 2021 18:35:50 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic304-24.consmr.mail.gq1.yahoo.com (sonic304-24.consmr.mail.gq1.yahoo.com [98.137.68.205]) (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 4DHVHT2ZbYz3MlJ for ; Fri, 15 Jan 2021 18:35:49 +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=1610735747; bh=lIB84cxvzAIWC+gvKvTPKN8DubCLYTlmUl1gf8zARNR=; h=Subject:From:Date:To:From:Subject:Reply-To; b=JqaZvxSbmG/CNq+fpc6FTBMSAPnT0uaa3NDy1hR+hTKoTFyXRzA9pvC7cRZeb9HdFIdz8ORaNNytTSZzTK0BJYo4n+CwTL5Uyd2bl4zZKU7pnYJ7PjE1LmOTqMmolgkDz760kRGC0vM5ZkySovSHoh4ChCrSFbDNcAbZQYV8+FD/+WiAms8xMjYWsQeK615EE3XxGRPUwb9OCds6KzeBnF+G0h9qneB8jWWmWGtlqTn63hh5iBItw6xHftMFcNqehtnCrDBN2J0TDsEwg/kfTcPJuU8N9Vx87il9PkidtiRA5r2Sd78qfY+8xYbo98qVtwN/f7t2OYsgLG3DeXnaNQ== X-YMail-OSG: 0FQaa_UVM1nkGDpwzEFlu2Gmy7UcyyC1ZTsrWOJHCedcZqvfV.Tgn7kTnem7.pa n8hbMshup4iNSaDsuM8GpaOtxoQtzg5FBeXip4k6OpVVfBvd_E4RjCF4FGku9gFmu5i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To22KDTBJQXBXJtrOzVuI23rwWuFMOi4W7XpmBLI5.PA7.R4HAT6gJxP4uuNCPvOmgO 5a2hx6sGpM0cgpmeTDZZj3fBn.C2fPpFoTgbwWHVT82PbT7r5EV4jUTvh_EY5JbSsswZ2UbhxTeX 6.bjnRQ4W.UFCgj2X3lEfWNitizvgITfTGcaoggVqi5KzroDmwyq_GjCVRyCdZbECHqwD3.13He7 ehSMLwLzlBZAiQ2RNYVhYQ.FOHvPP1evZXyUf6sn.akFMm7OINDU- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.gq1.yahoo.com with HTTP; Fri, 15 Jan 2021 18:35:47 +0000 Received: by smtp413.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID bb16447bb85ca7e565b5c209a3c5fd8a; Fri, 15 Jan 2021 18:35:43 +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: <2310709.D6tDg3Ca2R@t450s.local.lan> Date: Fri, 15 Jan 2021 10:35:40 -0800 Cc: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <4842729.YNO7O01DYZ@t450s.local.lan> <8D35ADAE-8904-4400-9DEB-7B274189BC30@yahoo.com> <2310709.D6tDg3Ca2R@t450s.local.lan> To: Walter von Entferndt X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Rspamd-Queue-Id: 4DHVHT2ZbYz3MlJ 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]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.68.205:from]; 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.68.205:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.68.205:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.68.205: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 18:35:50 -0000 On 2021-Jan-15, at 10:11, Walter von Entferndt = wrote: > At Freitag, 15. Januar 2021, 08:02:49 CET Mark Millard wrote: >> FYI: C itself has, in , CHAR_BIT for the number of bits in = a >> Byte for how sizeof counts Bytes: sizeof(char), sizeof(signed char), >> and sizeof(unsigned char) are each always 1. >>=20 > No, CHAR_BIT is the #bits in a *char*, which is the (standard) = datatype for=20 > the binary representation of a character/letter/symbol in written = human=20 > language, and for small integers. The name also suggests that, as = well as the=20 > comment in the header file. That does not necessarily equal a "byte", = which=20 > (by commonly accepted knowledge) is the smallest addressable entity in = a=20 > computer's memory. Of course, e.g. = https://code-reference.com/c/datatypes/ > char tells a *char* occupies one byte. Sadly, AFAIK C itself does not = define=20 > what a "byte" is, although that term is mentioned many times in = reference=20 > manuals (implicit assumption). So /theoretically/ CHAR_BIT and NBBY = can=20 > differ. In fact, many library funtions operating on = characters/letters take=20 > an *int* instead of a *char* for performance reasons. =46rom = https://code-reference.com/c/stdlib.h/sizeof: "the *sizeof* operator = returns the number of=20 > bytes to be reserved for a variable or a data type". Of course, for = practical=20 > reasons, we can safely assume that a *char* will take one byte in = storage=20 > space for the foreseeable future, since the consequences of changing = that=20 > would be disastrous. Have you read a (fairly modern) C standard or its officially published rationle? You might want to. =46rom the officially published C99 rationale (page labeled 11, Terms and definitions): QUOTE ) All objects in C must be representable as a contiguous sequence of = bytes, each of which is at least 8 bits wide. ) A char whether signed or unsigned, occupies exactly one byte. (Thus, for instance, on a machine with 36-bit words, a byte can be = defined to consist of 9, 12, 18, or 36 bits, these numbers being all the exact divisors of 36 which are not less than 8.) These strictures codify the widespread presumption that any object can be treated an an array of characters, the size of which is given by the sizeof operator with that object's type as its operand. END QUOTE =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)