什么是对象/结构体等的C ++内存布局? [英] What is the C++ memory layout of objects/structs etc?

查看:203
本文介绍了什么是对象/结构体等的C ++内存布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中我假设C ++标准与数据成员在类中如何排列无关,就内存布局而言?



我非常想学习如何表示对象和其他C ++实体(结构体等)物理内存(我知道列表是节点到节点和数组是连续的内存 - 但所有其他方面的语言)。



编辑: x86汇编器帮助这个和理解C ++更好?

解决方案

是的,标准没有说明对象将在存储器中表示。要了解normall C ++对象的表示方式,请阅读本书: C ++对象模型。


In C++ I presume the C++ standard has nothing to do with how data members are arranged within a class, in terms of memory layout? Would I be right in thinking this is down to the compiler in question?

I'm very interested in learning how objects and other C++ entities (structs etc) are represented in physical memory (I know things like lists are node to node and arrays are continuous memory- but all the other aspects to the language).

EDIT: Would learning x86 assembler help with this and understanding C++ better?

解决方案

Yes, the standard doesn't say how the objects are to be represented in memory. To get an idea how normall C++ objects are represented read this book: inside C++ object model.

这篇关于什么是对象/结构体等的C ++内存布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆