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


Groups > comp.lang.c++ > #29845

Re: deep copy or shallow copy?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newspeer1.nac.net!border4.nntp.dca.giganews.com!backlog4.nntp.dca3.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date Thu, 26 Jun 2014 07:43:35 -0500
From drew@furrfu.invalid (Drew Lawson)
Newsgroups comp.lang.c++
Subject Re: deep copy or shallow copy?
Date Thu, 26 Jun 2014 12:43:34 +0000 (UTC)
Organization Center for Unverified Assertions
Sender drew@furrfu.invalid
Message-ID <loh4hm$1qo7$1@raid.furrfu.com> (permalink)
References <645bf8d9-4e56-4398-aa39-056ba5e5d434@googlegroups.com> <slrnlqjn9i.o3q.grahn+nntp@frailea.sa.invalid>
X-Complaints-To usenet@raid.furrfu.com
X-Newsreader trn 4.0-test77 (Sep 1, 2010)
Originator drew@raid.furrfu.com (Drew Lawson)
Lines 22
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-HnAD4KVtAtmw57CZV9e8LQiUDUusczaa1ctJ2hoEF96+wQendf9ND1zyzjAFdRGtFvc3ijF7ZaLtuzR!vnDPqyls/yo6/M49kLmtIfeHO1C12MH0YZyb/H8ZovHAkSOWDYhALBk=
X-Complaints-To abuse@giganews.com
X-DMCA-Notifications http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2044
Xref csiph.com comp.lang.c++:29845

Show key headers only | View raw


In article <slrnlqjn9i.o3q.grahn+nntp@frailea.sa.invalid>
	Jorgen Grahn <grahn+nntp@snipabacken.se> writes:
>On Tue, 2014-06-24, mbalover2014@gmail.com wrote:
>>
>> memcpy(&a1,&a2,sizeof(A));
>>
>> is it a deep copy or still shallow copy?
>
>Doesn't matter; you shouldn't use memcpy() in C++ except in very
>special situations where you break the type checking on purpose.
>(And even in ancient C the memcpy() above is bad style IMO -- it adds
>unsafety but gives you no benefits at all.)

That depends on your metric for "ancient C."
When I learned C, you couldn't assign structs.

Not that C++ ever had that problem.

-- 
Drew Lawson            |  We were taking a vote when
                       |  the ground came up and hit us.
                       |      -- Cylon warrior

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


Thread

deep copy or shallow copy? mbalover2014@gmail.com - 2014-06-24 10:53 -0700
  Re: deep copy or shallow copy? Robert Wessel <robertwessel2@yahoo.com> - 2014-06-24 13:01 -0500
  Re: deep copy or shallow copy? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2014-06-24 20:19 +0000
    Re: deep copy or shallow copy? drew@furrfu.invalid (Drew Lawson) - 2014-06-26 12:43 +0000
      Re: deep copy or shallow copy? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2014-07-01 15:23 +0000
  Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-06-24 16:32 -0400
  Re: deep copy or shallow copy? Juha Nieminen <nospam@thanks.invalid> - 2014-06-26 04:48 +0000
    Re: deep copy or shallow copy? JiiPee <no@notvalid.com> - 2014-07-18 10:37 +0100
    Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-07-22 13:28 -0700
      Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-22 16:37 -0400
        Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-07-23 03:17 -0700
          Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-23 08:47 -0400
            Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-07-23 14:14 -0700
      Re: deep copy or shallow copy? Wouter van Ooijen <wouter@voti.nl> - 2014-07-23 09:28 +0200
      Re: deep copy or shallow copy? Juha Nieminen <nospam@thanks.invalid> - 2014-07-24 05:21 +0000
        Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-07-25 08:05 -0700
  Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-07-25 17:53 -0500
    Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-25 19:06 -0400
      Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-07-25 18:59 -0700
        Re: deep copy or shallow copy? ojackson520@gmail.com - 2014-07-25 23:56 -0700
        Re: deep copy or shallow copy? scott@slp53.sl.home (Scott Lurndal) - 2014-07-28 13:35 +0000
          Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-07-28 15:54 -0500
            Re: deep copy or shallow copy? David Brown <david.brown@hesbynett.no> - 2014-07-29 12:30 +0200
              Re: deep copy or shallow copy? Reinhardt Behm <rbehm@hushmail.com> - 2014-07-29 18:56 +0800
              Re: deep copy or shallow copy? Tobias Müller <troplin@bluewin.ch> - 2014-07-29 12:03 +0000
              Re: deep copy or shallow copy? scott@slp53.sl.home (Scott Lurndal) - 2014-07-29 14:21 +0000
                Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-29 12:39 -0400
                Re: deep copy or shallow copy? Martijn Lievaart <m@rtij.nl.invlalid> - 2014-07-29 18:48 +0200
                Re: deep copy or shallow copy? Wouter van Ooijen <wouter@voti.nl> - 2014-07-29 19:16 +0200
                Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-29 14:38 -0400
                Re: deep copy or shallow copy? scott@slp53.sl.home (Scott Lurndal) - 2014-07-29 19:24 +0000
                Re: deep copy or shallow copy? David Brown <david.brown@hesbynett.no> - 2014-07-30 11:08 +0200
              Re: deep copy or shallow copy? Paavo Helde <myfirstname@osa.pri.ee> - 2014-07-29 15:30 -0500
      Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-07-26 01:37 -0500
        Re: deep copy or shallow copy? Ian Collins <ian-news@hotmail.com> - 2014-07-26 20:22 +1200
          Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-07-26 03:19 -0700
            Re: deep copy or shallow copy? Wouter van Ooijen <wouter@voti.nl> - 2014-07-26 14:34 +0200
          Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-07-26 16:56 -0500
            Re: deep copy or shallow copy? Richard Damon <Richard@Damon-Family.org> - 2014-07-26 18:26 -0400
            Re: deep copy or shallow copy? Ian Collins <ian-news@hotmail.com> - 2014-07-27 11:14 +1200
            Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-27 10:54 -0400
              Re: deep copy or shallow copy? "Osmium" <r124c4u102@comcast.net> - 2014-07-27 10:01 -0500
                Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-07-27 16:12 -0700
              Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-27 14:35 -0400
              Re: deep copy or shallow copy? Stuart <DerTopper@web.de> - 2014-07-28 17:24 +0200
                Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-28 12:52 -0400
                Re: deep copy or shallow copy? scott@slp53.sl.home (Scott Lurndal) - 2014-07-28 18:43 +0000
            Re: deep copy or shallow copy? scott@slp53.sl.home (Scott Lurndal) - 2014-07-28 13:39 +0000
        Re: deep copy or shallow copy? Victor Bazarov <v.bazarov@comcast.invalid> - 2014-07-26 11:34 -0400
          Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-07-26 16:59 -0500
    Re: deep copy or shallow copy? scott@slp53.sl.home (Scott Lurndal) - 2014-07-28 13:32 +0000
      Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-07-28 14:28 -0500
        Re: deep copy or shallow copy? Juha Nieminen <nospam@thanks.invalid> - 2014-08-04 05:56 +0000
          Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-08-05 11:41 -0500
            Re: deep copy or shallow copy? Juha Nieminen <nospam@thanks.invalid> - 2014-08-07 11:03 +0000
              Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-08-07 12:29 -0500
        Re: deep copy or shallow copy? Öö Tiib <ootiib@hot.ee> - 2014-08-04 05:02 -0700
          Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-08-05 11:43 -0500
            Re: deep copy or shallow copy? Öö Tiib <ootiib@hot.ee> - 2014-08-05 17:13 -0700
              Re: deep copy or shallow copy? Lynn McGuire <lmc@winsim.com> - 2014-08-06 15:14 -0500
          Re: deep copy or shallow copy? CHIN Dihedral <dihedral88888@gmail.com> - 2014-08-20 20:56 -0700
  Re: deep copy or shallow copy? Mikołaj Małecki <ethouris@gmail.com> - 2014-08-11 00:13 -0700

csiph-web