From nobody Tue Mar 25 02:42:11 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZMDjJ3f9pz5rqsM for ; Tue, 25 Mar 2025 02:42:28 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic309-22.consmr.mail.gq1.yahoo.com (sonic309-22.consmr.mail.gq1.yahoo.com [98.137.65.148]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZMDjH0Xgbz3lG8 for ; Tue, 25 Mar 2025 02:42:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=ijWtX1uY; dmarc=pass (policy=reject) header.from=yahoo.com; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.65.148 as permitted sender) smtp.mailfrom=marklmi@yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1742870545; bh=Lbo29fw3K8fbQBMq3/Eu/UmdLYy9MP/0kGbZqquHBR0=; h=From:Subject:Date:To:References:From:Subject:Reply-To; b=ijWtX1uYhzD+PVAfOYjmgJI78R6LF74ELW5RaKdp/uSo25kICOvDLo4NvjxNwFlhsGcazVUrE2RcYPb1XwxhxPOUcFr+Fnjt9vL9bJzNrCSeuFFKVg9B7he3fsl1/ShMS5ROlZRZPSd7sFVYpNLpVimxsbGMZBOFXaMO76zTrsEFmOsgfOOk6R/ORk44GgPR9g6wDVda2/SSTt4iqNtP1GfqpXugFTxzVSeFQbhooAjpyNJQIK9DP/814Oi9ujDD7qrI+lSgRvAlc4Y8EvVgothWvNRT4KQGjQK2LRpmmZKtjfyJD9cSAoqGlcE9Q1kThW456CQjhjtwxfJDPgQ4gQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1742870545; bh=kZ1AIqyw61yry6xNiZqnx+f2g/Lph2MXOrGmrM9kMqj=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=bTaK3wVyjxMoBF2EYsI5QybpctutTT7JqlvpiWR0Ya9gCOKECQPk2BbzQkOF+o4PzfGtlSq8cSb6gbgNewNmFDjrBwaqQniOs+V6r99lCmtZIfaWTAxWly8ir+lc09RcRxm+RGnXZPqRDd6ZfYMBD28v19pmxoOPstzjkraTRCtWw7aGaX+sO3wfysfQOcBLTgAVKqQa8d94Cb0olmnbkws3TCsywjBfo5in9QyK2z336O/4lVtJPxSSZuX4y70cK/VOlzaSqC1HD453LtI5a0noS49bQmHBCqLmhu0Ru0nWdn7l8FGDERyfyZXjRDt99ZXQupD+O/E3dpUBPJDztg== X-YMail-OSG: qRxyyX8VM1kbWbFdk.U9Mg7FRwvKdHA194DCUG8S1bSjVhBscyUm28Vbqv5Tbbv oMYOQV8XCWYwM2e36xzECyBIch_GduMhasrsK.j.h6BqwqySGsg7QqNdBhBA1MN6Xx4IS5WFD9dH BjtTVzzsnCEmrLD5bzsKA9JOjHmOuQEI7tDEvGmCrc7UBZbvVJK8wQx5_krxTTCz7VOuEqagSZiO QzRojUn5GklxmQn6WQgU8pJ500uu0E5pVQtNGLMy.3NVvfnbIuxorUgxxVogm_.G_xArUo7882b3 MkFYHCxVFdIWXvsRl01rHzez3e62_4G0OmbVrhem239EUthRyg7nE.CBnEooeewdIfC6dHtqTwng pJhQd56eXNvBZEri3m0dcQkYHgtn4F3iKwQGRcTbJFUGNQb.lSmtG_3LeuZWaSFMUE4hsbv5Phr2 _Q_9RMh_E55g7orBf5lOkqJ3xMJhIgVOcN4qr7losmoTvp05AIjkuq_7h1cgiZhmnpPjAU06WqP9 ynjcmy8ONHaLGXbZf87dRYUGKybG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rJ7XeLbNhF1nawCWFBHfPPIKVhjd_aSDT4Vkgj6 OAy.faGdNfzgK6QVv9Qf51b7fAzDqahRNBh_MjvI3Xs7fvdIe0h_MyWdf3s4Y44La7lZ6pwWCYjX B.JQEirT5zroM9d1SZQ89EK8oKbWsLAHGHXfwT8ckZL5yTeONLiP3__QcPZ9UsgEW_.jVaWD_DO4 S1DaZux7YcHWf7UsGtAzF_t1e2nOYe0ScGG48SznRqWBA6vYCi_FCPKZc76XznNj8tE_LsNKyM7U D4OcyPZO1WQghlNLsbIWe5V3xLbUOBfKeDcsJfVOmirvKBmJotcuDyOANzKvh_oC02B6zTB6ig0L zj2Ed_a11iZM9flFhhxzBbqM5ehfPWKMq9TUx7nr8OXwxMikBj.g8Cv23AjH779oenk8DiadEMgd MXRaYIU1919nI9R1OiH067b.P1T1qYB0zROdyOVhQoObuVfkyEjSxQZImkwJ5vlm5nyxtXVJJ.iT 1n6xZCUKVWdZMO0FYRYu7NIgkaF7B.ACBCEw0JSyUjTeQFZFwrwj4oMXS9XG6PD4PA6HgVNQzXwj VrvBYNGjA0uNs7W7hR_ARO46ZeerftC2HXNOmUQdJKpk4xNQKoCVncFUAebGuZPbk95G2VHpQKxP AxbMPtn5xcCIShuTnvA8FRC2A1p3nEuQMUN_aSQqKjZBmybdunLbzAULOiibmMTaXRSlExwcSW5y Wuw-- X-Sonic-MF: X-Sonic-ID: b0f0a57c-8123-4a70-8825-404dbf6a9575 Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.gq1.yahoo.com with HTTP; Tue, 25 Mar 2025 02:42:25 +0000 Received: by hermes--production-gq1-5c477bf655-f7xj6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID ebaee51986b60d1137d8b623c26d9edc; Tue, 25 Mar 2025 02:42:22 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: git: c18a16ebcf5b - main - kern_proc_kqueues_out(): maxlen == -1 means there is no maxlen Message-Id: <9EAC57CC-CBB6-4039-B7EA-C1D41FADBB52@yahoo.com> Date: Mon, 24 Mar 2025 19:42:11 -0700 To: Ronald Klop , dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3826.400.131.1.6) References: <9EAC57CC-CBB6-4039-B7EA-C1D41FADBB52.ref@yahoo.com> X-Spamd-Result: default: False [-0.50 / 15.00]; RBL_SENDERSCORE_REPUT_9(-1.00)[98.137.65.148:from]; NEURAL_SPAM_LONG(1.00)[1.000]; NEURAL_SPAM_MEDIUM(1.00)[0.999]; NEURAL_HAM_SHORT(-0.99)[-0.995]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; MV_CASE(0.50)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_MATCH_FROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; FREEMAIL_FROM(0.00)[yahoo.com]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.65.148:from]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; DKIM_TRACE(0.00)[yahoo.com:+]; RCVD_IN_DNSWL_NONE(0.00)[98.137.65.148:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[] X-Rspamd-Queue-Id: 4ZMDjH0Xgbz3lG8 X-Spamd-Bar: / Olivier Certner wrote on Date: Mon, 24 Mar 2025 15:59:20 UTC " > > (snip)=20 > > > + if (maxlen =3D=3D -1 || maxlen =3D=3D 0) > > As maxlen is of the unsigned type size_t, how can it be -1? > > Or am I mistaken on this? >=20 > It's of course true that 'maxlen' can't be -1 mathematically as it has = an unsigned type, but that's not what 'maxlen =3D=3D -1' tests. In this = example, 'maxlen' is an unsigned type of size at least equal to = 'unsigned int', whose values cannot all be represented in a signed 'int' = (well, that last part is true but not the real reason, which has to do = with integer ranks). According to the standard promotion rules, and = because -1 as an integer constant is interpreted as of type 'int', both = arguments of '=3D=3D' will be converted to 'unsigned int', and = conversion of a signed type to an unsigned one is done by computing its = congruence to the number of values the latter can represent (this is the = mathematical description; with two-complement representation, that's = basically just truncating the bits that are "too high", or = sign-extending if the unsigned type destination is wider, and in this = precise case, just keeping the same exact representation bits). So, = basically, this test is equivalent to 'maxlen =3D=3D UINT_MAX' on 32-bit = machines or 'maxlen =3D=3D ULONG_MAX' on 64-bit ones. >=20 > Relevant C standard passages are, in section Language > Conversions > = Arithmetic operands, the "Boolean, characters, and integers", "Signed = and unsigned integers" and "Usual arithmetic conversions" chapters, and, = under Language > Expressions, the chapter about equality operators (in = particular, the fact that it states that the usual arithmetic = conversions apply), and chapter Language > Lexical elements > Constants = > Integer constants. (This does not invalidate the above material.) Another, longer C23 notation that avoids implicit "usual arithmetic conversions" for =3D=3D (or !=3D) and avoids any involvement of signed types when maxlen is unsigned: maxlen =3D=3D ~(typeof(maxlen))0u It also has the property of the notation surviving various type changes to maxlen that are still unsigned, without needing editing. These days (C23) there are parts of the language for which implicit conversions are not involved: QUOTE (from N3220): The constraints for constexpr objects are intended to enforce checks for portability at translation time. constexpr unsigned int minusOne =3D -1; // constraint violation constexpr unsigned int uint_max =3D -1U; // ok . . . END QUOTE Also: "An object declared with the constexpr specifier stores the exact value of its initializer, no implicit value change is applied." =3D=3D=3D Mark Millard marklmi at yahoo.com