Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Compiler optimizations of copying PODs
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="tommy.hinks, post: 3499847"] I am wondering if anyone knows how compilers auto-generate copy constructors for PODs. Let me explain what I mean with an example: struct A { int u; int v; }; If I were to write the copy constructor for the POD myself, I would write it like this: A::A(const A rhs) : u(rhs.u), v(rhs.v) {} the main point being that the member variables are initialized upon creation, and not created and then assigned a value, like this: A::A(const A rhs) { u = rhs.u; v = rhs.v; } Or perhaps some other form of bitwise (shallow) copying is done by the compiler for auto-generated PODs? Any thoughs on this? Thanks, T [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Compiler optimizations of copying PODs
Top