This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: memcpy(p,p,len)


On Fri, 2010-04-30 16:14:36 +0200, Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
> Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote on 2010/04/30 16:10:42:
> > On Fri, 2010-04-30 16:08:15 +0200, Joakim Tjernlund
> > <joakim.tjernlund@transmode.se> wrote:
> > > Is memcpy supposed to work when the src and dest are the same:
> > > memcpy(p, p, 100);
> >
> > It may work, but you cannot rely on it. Use memmove() alternatively.
> 
> My view too, but gcc 3.4.6 on gcc does this:
[...]

Surely, it may/will work here and there. But it's not portable :)  And
I won't rely on a "it worked once" fact.

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:          GDB has a 'break' feature; why doesn't it have 'fix' too?
the second  :

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]