From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2a.google.com (mail-oo1-xc2a.google.com [IPv6:2607:f8b0:4864:20::c2a]) by sourceware.org (Postfix) with ESMTPS id 87D1C3858D39 for ; Wed, 4 Jan 2023 20:19:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87D1C3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-xc2a.google.com with SMTP id c190-20020a4a4fc7000000b004a3addd10b5so6659757oob.1 for ; Wed, 04 Jan 2023 12:19:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=sA7rdrp6finiASXqE0YvLEUJ5cWfGv3JC/v+lZ3Z0EI=; b=KKBbhnuIFb4E7+2VtzpOOeBSBIVq4SOJH8PW6tGmwivih110j0LzF2oZhCMBqLTTm9 LEGB4Im4Nwk9F9rkgYRq+gVJULbL5ND+s1E6phGYYHVJcDiRGSujCJtH803DD2FDkywg eEKU3ruMEzbz0bDxrTVfmK2rqpgKtinnWZbERAJtmQMj9wjcwL9Yx2OHUss/9PfVevKX 2eh9IREz9POma6+0wJRCj6v/5zD1tzPwpOR2rBDfin+vctBMgmcnpHyZd5Xj7In8d5td mOLzfJpcMnNScObMvSrPporcYrma3M2vpO++kiXhF7xZqw//6cdMFXZ43JqGSJxRzoI8 rm9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sA7rdrp6finiASXqE0YvLEUJ5cWfGv3JC/v+lZ3Z0EI=; b=mDCHclvWMxmQ7m/X0SuE/OR6tXSZb0LF3ggpHInH99I3TZWx/UHTB/zC8nNZ5HXoas LhQv0S2Zv/Fi6HBRzrw3Fogw3cqD3fEoXnw94n9y9nbps66vcGC43Qc47ce26HksKicW Ty3QM6B9ymWmo4dCrmrZ528gdLuK4N459j4AzQx7PxSVhnAVkuBnUNO8xbiVbSz6LtSE DWijqHlMoT4DxAksdboNNmg8MfHmnwcemkjX5phVmzZJkdOW97HLB+wDcuEm2sBmGMtN jL+MryTCYpNtSwYnoqwTygYIbCGt9h2UFWFcsLjtAgCrISS9I0Oz1cNgCbaBacif45Nq JVeg== X-Gm-Message-State: AFqh2kqzihL2Mm7/8QigH7aeZx73MY7qrSin97w7mvjt5ZYZKakQ0wLz xXmn/RXFgOTTxsVZ2Nm760M= X-Google-Smtp-Source: AMrXdXuBbseG2ddnwQ+O08yJeKU8pxaS3AY6RGOCiOIx7vEQSn7bIUeSDtLvjNd6F4mXf5GRHjB1tA== X-Received: by 2002:a4a:3311:0:b0:4a0:b7b9:f1f0 with SMTP id q17-20020a4a3311000000b004a0b7b9f1f0mr22197201ooq.1.1672863565747; Wed, 04 Jan 2023 12:19:25 -0800 (PST) Received: from illithid (ip68-12-97-90.ok.ok.cox.net. [68.12.97.90]) by smtp.gmail.com with ESMTPSA id l15-20020a4acf0f000000b004a05e943f9esm13899488oos.21.2023.01.04.12.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 12:19:25 -0800 (PST) Date: Wed, 4 Jan 2023 14:19:23 -0600 From: "G. Branden Robinson" To: Wilco Dijkstra Cc: Alejandro Colomar , 'GNU C Library' , Cristian =?utf-8?Q?Rodr=C3=ADguez?= , Damian McGuckin , Alexis Subject: Re: [manual]: rawmemchr(3) and UB Message-ID: <20230104201923.nd6tovbtmsghi27d@illithid> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ui5tbonbidoidj3a" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --ui5tbonbidoidj3a Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Since I'm CCed on this I'll chuck in two cents... At 2023-01-04T19:41:30+0000, Wilco Dijkstra wrote: > > bzero(3) is much more useful than memset(3).=A0 I've only used > > memset(3) for something non-zero once in my life, IIRC.=A0 Writing > > bzero(p, n) is easier to get right, and simpler. >=20 > It may save a few keypresses but it's dead so all you're doing is > confuse people who have never heard of it... I agree with Wilco here. My understanding is that memset(), memcpy(), and memmove() are almost C language primitives masquerading as function calls, in that the language is _unimplementable_, even in a freestanding environment, without them. (How are you going to copy a struct? How are you going to work safely with hunks of allocated memory?[1]) The line between language runtime services and operating system services is fuzzy in C, at least as the the language is presented and taught. Slowly, over time, that line is being clarified, to the horror of those who remember writing C on a PDP-11. You can always have your own static function: memclear() or something. The b in bzero() or for Bad BSD Bogosity. Ban it. :P Like index() and rindex() it is duplicative. Regards, Branden [1] That last point may be contrived. For many years, no one cared. --ui5tbonbidoidj3a Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmO130MACgkQ0Z6cfXEm bc6ELQ//f9FHZ2hmKBofLjPQ2aaDd9hqeyEZkw/kBoEXlSRyWL2zVhastKhvkKFp 6d947XZycdkqjxj8/YxfwgTO52Ml5tP3VhhjFZAmMas5zPH0fWWN1OmtiZIyhyYs 0k52QJUZsYjXOd3o88M22weCwhtJq+HJ/sH1GwdTzn6ZVmM47bok3Vcb5tnic//c xViInqKjDYkauQi3Gntqwf8X9KE+qy9mEPu4RCrrij4Cl4ku46UG1kPtPCaPeyUl 2+B2Dx6kAimFZbx7bsiYTQsQe12FW3YqRi186uHVhKBS3Jdfy20g86oT7C3nMNUX MiHhwlFudY2qblLiXpxZkLGm1fzrjzUVzIKJj4nyCRyXX7MZVCZOj9k1ll/LXO1x qlZzSA3GnTjRbSYB6MnR2PKPHRte4RTWT3RHNiUSKq/U9eEIM8dgMbEaot9YkS11 lw2fUb1ERBMFmbyyYniOpIkf9RSuuQ1QpZ1jVWgf7YsgMXeuog8Nk8ARMcWQBGb3 noVB1iXOd2r3HY5cBkTnFucY6IIE4dF2jjJffVUp6hBVzZmkDo9PeZPx+nhj1+wS yaZqWTjlAZFqZNKYAqdfJuPWUtURKp2vTPIOyamKXIRoIqGZTpJPMcSvP9flYKql OXkB2qchZIB7jNvDZoEQAxh6yDg3GdEdiERNA7dLLJSJBeZu1X8= =osMy -----END PGP SIGNATURE----- --ui5tbonbidoidj3a--