Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #163279

Re: memcpy with NULL pointer

Message-Id <ue195i-892.ln1@aretha.foo>
From Peter 'Shaggy' Haywood <phaywood@alphalink.com.au>
Subject Re: memcpy with NULL pointer
Newsgroups comp.lang.c
Date 2021-11-03 11:24 +1100
References <slgdn2$1v7q$1@gioia.aioe.org> <86ee84f70q.fsf@linuxsc.com>

Show all headers | View raw


Groovy hepcat Tim Rentsch was jivin' in comp.lang.c on Fri, 29 Oct 2021
09:40 pm. It's a cool scene! Dig it.

> Steve Keller <keller.steve@gmx.de> writes:
> 
>> I wonder whether calling the mem* and str* functions with a NULL
>> pointer has defined bahavior if the count parameter is also 0,
>> like in this call

  [Snip.]

>> Since no memory access via the NULL pointer is done I'd assume
>> this should not result in undefined behavior.
> 
> That's a plausible assumption but not one that the C standard
> supports.

  But, of course, undefined behaviour could be perfectly benign. Just
don't count on it in every case.

-- 


----- Dig the NEW and IMPROVED news sig!! -----


-------------- Shaggy was here! ---------------
              Ain't I'm a dawg!!

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

memcpy with NULL pointer Steve Keller <keller.steve@gmx.de> - 2021-10-29 11:08 +0200
  Re: memcpy with NULL pointer Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-29 03:40 -0700
    Re: memcpy with NULL pointer Steve Keller <keller.steve@gmx.de> - 2021-10-29 23:06 +0200
      Re: memcpy with NULL pointer Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-29 14:23 -0700
      Re: memcpy with NULL pointer scott@slp53.sl.home (Scott Lurndal) - 2021-10-29 21:48 +0000
        Re: memcpy with NULL pointer Steve Keller <keller.steve@gmx.de> - 2021-11-23 09:58 +0100
      Re: memcpy with NULL pointer Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-29 18:44 -0700
        Re: memcpy with NULL pointer Guillaume <message@bottle.org> - 2021-10-30 18:25 +0200
          Re: memcpy with NULL pointer Steve Keller <keller.steve@gmx.de> - 2021-11-23 10:26 +0100
            Re: memcpy with NULL pointer Dolores Filandro <dolfiland8@gmail.com> - 2021-12-20 13:32 -0800
              Re: memcpy with NULL pointer Öö Tiib <ootiib@hot.ee> - 2021-12-20 16:56 -0800
                Re: memcpy with NULL pointer Richard Damon <Richard@Damon-Family.org> - 2021-12-20 20:39 -0500
                Re: memcpy with NULL pointer Öö Tiib <ootiib@hot.ee> - 2021-12-20 18:31 -0800
    Re: memcpy with NULL pointer Peter 'Shaggy' Haywood <phaywood@alphalink.com.au> - 2021-11-03 11:24 +1100
      Re: memcpy with NULL pointer James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-11-03 10:52 -0400
        Re: memcpy with NULL pointer Manfred <noname@add.invalid> - 2021-11-03 17:46 +0100
      Re: memcpy with NULL pointer Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-11-06 14:57 -0700

csiph-web