zoukankan      html  css  js  c++  java
  • C++对象内存布局

    代码一:

    itTmp = mapInfo.find("NodeNum");
            if (itTmp != mapInfo.end())
            {
                int nMaxNodes = StrToInt(itTmp->second);
                map<SQLNODED, vector<SQLNODED> > mapNodes;
                CCIM *pCCIM = CCIM::GetInstance();
                pCCIM->GetDataNode(mapNodes);
                printf("There is %d nodes
    ", mapNodes.size());
                if (mapNodes.size() > nMaxNodes)
                {
                    printf("Too much data nodes, the max data nodes is %d
    ", MAX_DATA_NODES);
                    return false;
                }
            }

    单步调试结果:

    代码二:

    #include <iostream>
    using namespace std;
    
    class CBase
    {
    public:
        CBase()
        {
            m_nBnum = 10;
        }
        ~CBase()
        {}
    private:
        int m_nBnum;
    };
    
    class CDerive : public CBase
    {
    public:
        CDerive()
        {
            m_nDnum = 20;
        }
        ~CDerive()
        {}
    private:
        int m_nDnum;
    };
    
    int main(int argc, char **argv)
    {
        CBase b;
        CDerive d;
        cout << "base size : " << sizeof(b) << endl;
        cout << "derive size : " << sizeof(d) << endl;
    
        return 0;
    }

    单步调试结果:

  • 相关阅读:
    HTTP报文详解
    常用的HTTP协议
    URL详解
    一起切磋
    emacs使用指南
    SSH自动部署
    linux上应用随机启动
    让Maven正确处理javac警告
    最近的学习
    Java application 性能分析分享
  • 原文地址:https://www.cnblogs.com/lit10050528/p/4342521.html
Copyright © 2011-2022 走看看