Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #151280
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
| Newsgroups | comp.lang.c |
| Subject | Re: memcpy can't take null. |
| Date | Thu, 09 Apr 2020 13:28:10 -0700 |
| Organization | None to speak of |
| Lines | 36 |
| Message-ID | <87tv1sjtet.fsf@nosuchdomain.example.com> (permalink) |
| References | <6c3de07e-15c8-4cc0-a805-636a5976d086@googlegroups.com> <r6i3vk$14n3$1@gioia.aioe.org> <87zhbnl10s.fsf@nosuchdomain.example.com> <r6j33u$15ev$1@gioia.aioe.org> <dW8jG.1373649$hD4.309580@fx47.iad> <8338dd09-dfed-447b-adf0-356695b1b1d8@googlegroups.com> <87a73llnu4.fsf@nosuchdomain.example.com> <3abbeb80-4c62-410e-a133-82d03e72b113@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | reader02.eternal-september.org; posting-host="721337e81c79c5f5d54b212b11a7fff7"; logging-data="5942"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6sbkFRnzTh2KeJ5O4gI9A" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
| Cancel-Lock | sha1:sSvwS20C1aQmQMiFaUui9dL3frg= sha1:3RS3kaGVTSbF4DOYcp6nO2RSd3E= |
| Xref | csiph.com comp.lang.c:151280 |
Show key headers only | View raw
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
[...]
> The standard is clear, though you have to refer back to the
> preamble on library functions to read it. An array argument may
> not be null unless otherwise specified, as happens for snprintf().
>
> However if you look in the Apple man page for memcpy, the issue
> is nowhere to be seen.
Perhaps not directly. The Apple man page for memcpy (at least the
one I found in a quick Google search) says:
The memcpy() function copies n bytes from memory area s2 to memory
area s1. If s1 and s2 overlap, behavior is undefined. Applications
in which s1 and s2 might overlap should use memmove(3) instead.
The phrase "memory area s2" seems a bit vague. Perhaps Apple's
documentation defines it elsewhere. But surely if s2 is a null pointer
there is no "memory area s2" (and likewise for s1, of course).
But it also says:
The memcpy() function conforms to ISO/IEC 9899:1990 (``ISO C90'').
which does completely describe it.
The Linux man page for memcpy is similar.
In any case the definitive documentation for memcpy is the standard.
And when you document your own functions, I don't suggest following
the example of those man pages.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
memcpy can't take null. Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-04-05 06:47 -0700
Re: memcpy can't take null. Öö Tiib <ootiib@hot.ee> - 2020-04-05 07:30 -0700
Re: memcpy can't take null. Richard Damon <Richard@Damon-Family.org> - 2020-04-05 14:39 -0400
Re: memcpy can't take null. Philipp Klaus Krause <pkk@spth.de> - 2020-04-06 18:46 +0200
Re: memcpy can't take null. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-06 12:45 -0700
Re: memcpy can't take null. Philipp Klaus Krause <pkk@spth.de> - 2020-04-07 07:28 +0200
Re: memcpy can't take null. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-05 16:00 -0700
Re: memcpy can't take null. Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-04-05 18:29 -0600
Re: memcpy can't take null. scott@slp53.sl.home (Scott Lurndal) - 2020-04-06 18:08 +0000
Re: memcpy can't take null. Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-04-06 15:44 -0600
Re: memcpy can't take null. Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-04-06 13:54 -0700
Re: memcpy can't take null. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-06 14:30 -0700
Re: memcpy can't take null. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-04-06 01:20 +0100
Re: memcpy can't take null. Siri Cruise <chine.bleu@yahoo.com> - 2020-04-05 19:09 -0700
Re: memcpy can't take null. Guillaume <message@bottle.org> - 2020-04-07 16:50 +0200
Re: memcpy can't take null. Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-04-07 09:19 -0700
Re: memcpy can't take null. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-07 09:21 -0700
Re: memcpy can't take null. Guillaume <message@bottle.org> - 2020-04-08 01:41 +0200
Re: memcpy can't take null. scott@slp53.sl.home (Scott Lurndal) - 2020-04-08 00:30 +0000
Re: memcpy can't take null. Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-04-08 02:06 -0700
Re: memcpy can't take null. Richard Damon <Richard@Damon-Family.org> - 2020-04-08 09:17 -0400
Re: memcpy can't take null. Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-04-09 07:16 -0700
Re: memcpy can't take null. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-08 13:33 -0700
Re: memcpy can't take null. Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-04-09 09:05 -0700
Re: memcpy can't take null. Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-09 13:28 -0700
Re: memcpy can't take null. richard@cogsci.ed.ac.uk (Richard Tobin) - 2020-04-09 23:41 +0000
Re: memcpy can't take null. Guillaume <message@bottle.org> - 2020-04-08 16:17 +0200
Re: memcpy can't take null. Ike Naar <ike@sdf.lonestar.org> - 2020-04-07 22:01 +0000
Re: memcpy can't take null. Guillaume <message@bottle.org> - 2020-04-08 01:32 +0200
csiph-web