bool°ú BOOLÀÇ Â÷ÀÌ


1.¿ä¾à

bool°ú BOOLÀÇ Â÷ÀÌ¿¡ ´ëÇØ ¾Ë¾Æº»´Ù.


2.º»¹®

- bool : ±âº» C++ÀÇ µ¥ÀÌÅÍ Å¸ÀÔ, 1¹ÙÀÌÆ®ÀÇ Å©±â
true, false°ª¸¸ °®´Â´Ù. true¿Í false ¿ª½Ã C++ÀÇ ±âº» Ű¿öµå
- BOOL : MFC¿¡¼­ Á¤ÀǵǾî ÀÖ´Â µ¥ÀÌÅÍ Å¸ÀÔ, 1¹ÙÀÌÆ®°¡ ¾Æ´Ï¶ó 4¹ÙÀÌÆ®ÀÇ Å©±â
TRUE, FALSE °ªÀ» °®°í true¿Í false ¿ª½Ã °¡´É
TRUE¿Í FALSE¿ª½Ã MFC¿¡¼­ Á¤ÀǵǾî Àִ Ű¿öµå

3.¿¹Á¦


CString msg; 

msg.Format("bool's sizeof : %d, BOOL's sizeof : %d",sizeof(bool), sizeof(BOOL)); 

AfxMessageBox(msg); 

°á°ú
bool's sizoef : 1, BOOL's sizeof : 4

4.Âü°í

MSDN ¿¡¼­ ã¾Æº¸´Ï ¾Æ·¡¿Í °°Àº ±ÛÀÌ ÀÖ¾ú½À´Ï´Ù.

Microsoft Specific

In Visual C++4.2, the Standard C++ header files contained a typedef that equated bool with int. In Visual C++ 5.0 and later, bool is implemented as a built-in type with a size of 1 byte. That means that for Visual C++ 4.2, a call of sizeof(bool) yields 4, while in Visual C++ 5.0 and later, the same call yields 1. This can cause memory corruption problems if you have defined structure members of type bool in Visual C++ 4.2 and are mixing object files (OBJ) and/or DLLs built with the 4.2 and 5.0 or later compilers.

Áï, 4.2¿¡¼­´Â int ¿Í °°Àº ÇüÀ¸·Î ¼±¾ðÀÌ µÇ¾î ÀÖ¾ú´Âµ¥, ÈÄ¿¡ built-in type À¸·Î ¹Ù²î¸é¼­ 1 byte·Î ¹Ù²î¾ú´Ù´Â ±º¿ä..



- 2001.08.13 Smile Seo -