woaidongmao

文章均收录自他人博客,但不喜标题前加-[转贴],因其丑陋,见谅!~
随笔 - 1469, 文章 - 0, 评论 - 661, 引用 - 0
数据加载中……

struct初始化列表为0的bug

在Debug模式下的VC6 Watch的bug

 

1、如果symbol为12的话,出现了-52的值

struct __SpecSymbolMarginEEE
{
    char    symbol[12];
    double    spec_margin;
    bool operator<(const __SpecSymbolMarginEEE& other) const
        {return (0 > strcmp(symbol, other.symbol));}
    bool operator==(const __SpecSymbolMarginEEE& other) const
        {return (0 == strcmp(symbol, other.symbol));}
};

__SpecSymbolMarginEEE ssm = {0};

image

 

2、如果symbol为32的话,正常

struct __SpecSymbolMarginEEE
{
    char    symbol[32];
    double    spec_margin;
    bool operator<(const __SpecSymbolMarginEEE& other) const
        {return (0 > strcmp(symbol, other.symbol));}
    bool operator==(const __SpecSymbolMarginEEE& other) const
        {return (0 == strcmp(symbol, other.symbol));}
};

__SpecSymbolMarginEEE ssm = {0};

image

posted on 2009-07-07 11:45 肥仔 阅读(561) 评论(0)  编辑 收藏 引用 所属分类: VC 存档


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理