public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: "Alejandro Colomar" <alx.manpages@gmail.com>,
	"'GNU C Library'" <libc-alpha@sourceware.org>,
	"Cristian Rodríguez" <crrodriguez@opensuse.org>,
	"Damian McGuckin" <damianm@esi.com.au>,
	Alexis <flexibeast@gmail.com>
Subject: Re: [manual]: rawmemchr(3) and UB
Date: Wed, 4 Jan 2023 14:19:23 -0600	[thread overview]
Message-ID: <20230104201923.nd6tovbtmsghi27d@illithid> (raw)
In-Reply-To: <PAWPR08MB8982D63060940F2320D8102283F59@PAWPR08MB8982.eurprd08.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

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).  I've only used
> > memset(3) for something non-zero once in my life, IIRC.  Writing
> > bzero(p, n) is easier to get right, and simpler.
> 
> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2023-01-04 20:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 19:41 Wilco Dijkstra
2023-01-04 20:05 ` Alejandro Colomar
2023-01-04 20:19 ` G. Branden Robinson [this message]
2023-01-04 20:34   ` Alejandro Colomar
2023-01-05 12:21   ` G. Branden Robinson
  -- strict thread matches above, loose matches on Subject: below --
2022-12-30 13:13 Wilco Dijkstra
2022-12-30 14:16 ` Alejandro Colomar
2022-12-29 19:19 Alejandro Colomar
2022-12-29 19:27 ` Alejandro Colomar
2022-12-29 19:45 ` Cristian Rodríguez
2022-12-29 19:50   ` Alejandro Colomar
2022-12-30 10:31     ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230104201923.nd6tovbtmsghi27d@illithid \
    --to=g.branden.robinson@gmail.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=alx.manpages@gmail.com \
    --cc=crrodriguez@opensuse.org \
    --cc=damianm@esi.com.au \
    --cc=flexibeast@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).