`
jimmy_c
  • 浏览: 14698 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

greta在vc express 2008下编译失败

阅读更多
支持vc6和vs.net。在2008下产生C2923。
似乎是原有hetero_stack::stack_node::header结构现在不能看作类型了。

将原有code
struct stack_node
{
    struct header
    {
        stack_node * m_back;
        stack_node * m_next;
        byte_t     * m_current; // ptr into m_mem. alloc from here
        byte_t     * m_end;     // ptr to last+1 byte_t in m_mem
    };

    union
    {
        header  m_head;
        byte_t  m_align[ aligned_sizeof<header>::no_rtti ];
    };

    // This is the buffer into which values will be pushed and popped.
    // It is guaranteed to meet the AlignmentT requirements because of
    // the union above.
    byte_t  m_mem[1];

    size_t size() const // throw()
    {
        return static_cast<size_t>( m_head.m_end - m_mem );
    }
};

改为
struct stack_node_header;

struct stack_node
{
    union
    {
        stack_node_header  m_head;
        byte_t  m_align[ aligned_sizeof<stack_node_header>::no_rtti ];
    };

    // This is the buffer into which values will be pushed and popped.
    // It is guaranteed to meet the AlignmentT requirements because of
    // the union above.
    byte_t  m_mem[1];

    size_t size() const // throw()
    {
        return static_cast<size_t>( m_head.m_end - m_mem );
    }
};

struct stack_node_header
{
    stack_node * m_back;
    stack_node * m_next;
    byte_t     * m_current; // ptr into m_mem. alloc from here
    byte_t     * m_end;     // ptr to last+1 byte_t in m_mem
};

并将引用:
byte_t      m_buf[ aligned_sizeof<stack_node::header>::no_rtti + StaticBlockSizeT ];

改为:
byte_t      m_buf[ aligned_sizeof<stack_node_header>::no_rtti + StaticBlockSizeT ];

编译通过。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics