(ex.)つねに次の形式を守る。
void CMyClass::Routine(CMyObject* pMyObject)
{
if(pMyObject)
{
ASSERT_KINDOF(CMyObject, pMyObject); //エラーは、開発時エラー*
...;
}
else
{
#ifdef DEBUG
...; //デバッグ・コーディング
#endif
}
}
*CMyObjectクラスでは、[DECLARE_DYNAMIC] 宣言されている必要がある。
(ex.)つねに次の形式を守る。
void CMyClass::Routine(CObList* pObList)
{
CMyObject* pMyObject = pObList->GetAt(0);//*
if(pMyObject)
{
ASSERT_KINDOF(CMyObject, pMyObject); //エラーは、開発時エラー
...;
}
else
{
#ifdef DEBUG
...; //デバッグ・コーディング
#endif
}
}
*CObList* の検定省略。
MICROSFT | C++ | 値範囲 | 参照 | コメント | ||
種類 | 定義 | 説明 | ||||
INT_PTR | 符号付きポインターの精度の整数の型 |
As the pointer precision changes (that is, as it becomes 32 bits when compiled for 32-bit platforms, 64 bits when compiled for 64-bit platforms), these data types reflect the precision accordingly. |
(32 bits) signed, signed int, int (64 bits) long long, signed long long |
__int32 :: 4 bytes:: -2,147,483,648 to 2,147,483,647 __int64 :: 8 bytes:: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Microsoft, Hardware Dev Censer, The New Data Types. Docs, Data Type Ranges. (+同邦訳サイト) |
MFC CObList::GetCountなどの戻り値として利用されるので、これを利用するときには、追従必至。 |
UINT | An unsigned INT. |
An unsigned INT. The range is 0 through 4294967295 decimal.(05/31/2018) The types __int8, __int16, and __int32 are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms. The __int8 data type is synonymous with type char, __int16 is synonymous with type short, and __int32 is synonymous with type int. The __int64 type is synonymous with type long long.(10/09/2018) |
unsigned INT INT: A 32-bit signed integer. The range is -2147483648 through 2147483647 decimal. |
An unsigned INT. The range is 0 through 4294967295 decimal. __int32 :: 4 bytes:: -2,147,483,648 to 2,147,483,647 |
Microsoft, Windows Dev Censer, Windows Data Types. Microsoft, Built-in types, __int8, __int16, __int32, __int64. |
メモリを節約する意図で __int8, __int16 を用いても、Windows環境では意味がない。 Visual Studio のコンパイラレベルで __int32 または __int64 に変換されてしまう。 |