🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #222

Re: overlapping objects

#222
From: John F. Woods
Date: Wed, 15 Apr 1992 15:45
17 lines
828 bytes
andrew@lsa.ncl.omron.co.jp (Andrew Walduck) writes:
>What exactly is an overlapping object in ANSI??

The Standard does not appear to have an explicit definition, so one has
to rely on common sense.  Two objects overlap if they share any storage
at all.

>char buffer[5];
>memcpy(buffer, buffer, 5);
>Is this a call to memcpy with overlapping objects?? 

Yes.

>And so...its perfectly alright for memcpy to dump core?? 

"The behavior is undefined."  It may dump core, it may work, it may set fire
to your collection of rare Beatles LPs.
Technical Details
Message-ID: <11458@ksr.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!world!ksr!jfw
References: <1412@frf.omron.co.jp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!world!ksr!jfw
From: jfw@ksr.com (John F. Woods)
Newsgroups: comp.std.c
Subject: Re: overlapping objects
Keywords: ANSI
Message-ID: <11458@ksr.com>
Date: 15 Apr 92 11:45:19 EDT
References: <1412@frf.omron.co.jp>
Sender: news@ksr.com
Lines: 17