ChefZ -- 磨劍錄 (A Coder's Log)

慣看秋月春風 一壺濁酒喜相逢 古今多少事 皆賦談笑中
posts - 42, comments - 3, trackbacks - 0, articles - 6
#pragma message(BP "fix me")
__asm int 3;

/*
ValueUsage
0xCDCDCDCD Allocated in heap, but not initialized
0xDDDDDDDD Released heap memory.
0xFDFDFDFD "NoMansLand" fences automatically placed at boundary of heap memory. Should never be overwritten. If you do overwrite one, you're probably walking off the end of an array.
0xCCCCCCCC Allocated on stack, but not initialized

*/
(pFoo + 2000),10

// checked_cast - Uses fast static_cast in Release build,
// but checks cast with an ASSERT in Debug.
// Typical usage:
// class Foo { /* ... */ };
// class Bar : public Foo { /* ... */ };
 // Foo * pFoo = new Bar;
 // Bar * pBar = checked_cast<;Bar *>;(pFoo);
 template <class TypeTo, class TypeFrom>
 TypeTo checked_cast(TypeFrom p)
 {
     ASSERT(dynamic_cast<TypeTo>(p));
    return static_cast<TypeTo>(p);
}

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