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++
Default ctor, etc generated by compiler for structs?
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="JohnQ, post: 2933555"] I'm concerned about blasting it around like a C struct. That and keeping the size the same. Understood. That's what the constructor/copy constructor/assignment operator/destructor do as together: make classes (or structs) behave like built-in types. See, now I think someone else said that those things would be generated (maybe they didn't). I had a feeling they weren't. So that's saying restricting those things in structs is unnecessary. Hmmm... now if a class is defined just like a struct but has the class' So I lose all guarantees about the layout and size of thing (it's implemenation-specific what the thing looks like in memory?)? OK. So, don't use it like a C struct ever? You see what I'm trying to indicate though right? That I want to be able to memcpy these things and the like, based upon their size. It was actually a question. And when it deviates from that. The moment I use 'private' in a struct, all bets are off? Meaning there could be something tucked between the start of the object in memory and the first data member? What about a struct with constructor? What about a struct with just POD data members? OK. Someone else said that memberwise copy was done. That's getting away from "struct with only POD data members", and that is what I'm really only concerned with. John [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Default ctor, etc generated by compiler for structs?
Top