Click here to Skip to main content
15,908,909 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMACRO vs INLINE FUNCTION Pin
avenger_sb2525-May-04 4:48
avenger_sb2525-May-04 4:48 
GeneralRe: MACRO vs INLINE FUNCTION Pin
Maximilien25-May-04 4:53
Maximilien25-May-04 4:53 
GeneralRe: MACRO vs INLINE FUNCTION Pin
David Crow25-May-04 5:48
David Crow25-May-04 5:48 
GeneralRe: MACRO vs INLINE FUNCTION Pin
Curi0us_George25-May-04 6:32
Curi0us_George25-May-04 6:32 
GeneralRe: MACRO vs INLINE FUNCTION Pin
Gary R. Wheeler25-May-04 15:04
Gary R. Wheeler25-May-04 15:04 
GeneralRe: MACRO vs INLINE FUNCTION Pin
avenger_sb2525-May-04 17:48
avenger_sb2525-May-04 17:48 
Questionsize of an empty class?? Pin
avenger_sb2525-May-04 4:41
avenger_sb2525-May-04 4:41 
AnswerRe: size of an empty class?? Pin
jmkhael25-May-04 4:53
jmkhael25-May-04 4:53 
i did just that in VC++

class A
{
};

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int i = sizeof(A);
cout << "Sizeof A:" << i << endl;
}

it displayed 1.

I switched to assebmly listing and the linker has generated the following code:

77: int i = sizeof(A);
004018AB mov dword ptr [i],1 <----- Notice here, the linker knew its an empty class and automatically replaced its size by 1
78:
79: cout << "Sizeof A:" << i << endl;
004018B2 mov esi,esp
004018B4 mov edx,dword ptr [__imp_?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z
004018BA push edx
004018BB mov edi,esp
004018BD mov eax,dword ptr [i]
004018C0 push eax
004018C1 mov ebx,esp
004018C3 push offset string "Sizeof A:" (004130d4)
004018C8 mov ecx,dword ptr [MSVCP60D_NULL_THUNK_DATA (00415234)]
004018CE push ecx
004018CF call dword ptr [__imp_??6std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z (004
004018D5 add esp,8
004018D8 cmp ebx,esp
004018DA call _chkesp (004014bc)
004018DF mov ecx,eax
004018E1 call dword ptr [__imp_??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z (0041523c)
004018E7 cmp edi,esp
004018E9 call _chkesp (004014bc)
004018EE mov ecx,eax
004018F0 call dword ptr [__imp_??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01
004018F6 cmp esi,esp
004018F8 call _chkesp (004014bc)




Papa


while (TRUE)
Papa.WillLove ( Bebe ) ;
GeneralRe: size of an empty class?? Pin
avenger_sb2525-May-04 5:01
avenger_sb2525-May-04 5:01 
GeneralRe: size of an empty class?? Pin
jmkhael25-May-04 5:10
jmkhael25-May-04 5:10 
GeneralRe: size of an empty class?? Pin
Curi0us_George25-May-04 6:38
Curi0us_George25-May-04 6:38 
AnswerRe: size of an empty class?? Pin
David Crow25-May-04 5:57
David Crow25-May-04 5:57 
AnswerRe: size of an empty class?? Pin
Nemanja Trifunovic25-May-04 6:01
Nemanja Trifunovic25-May-04 6:01 
GeneralRe: size of an empty class?? Pin
avenger_sb2525-May-04 17:46
avenger_sb2525-May-04 17:46 
Generalmenu next to images Pin
Member 466743725-May-04 4:34
Member 466743725-May-04 4:34 
GeneralRe: menu next to images Pin
jmkhael25-May-04 4:43
jmkhael25-May-04 4:43 
GeneralRe: menu next to images Pin
Member 466743725-May-04 9:26
Member 466743725-May-04 9:26 
GeneralRe: menu next to images Pin
Maximilien25-May-04 9:30
Maximilien25-May-04 9:30 
GeneralRe: menu next to images Pin
Member 466743726-May-04 11:14
Member 466743726-May-04 11:14 
GeneralQuestion about Saving Fonts. Pin
Mike Doner25-May-04 4:15
Mike Doner25-May-04 4:15 
GeneralRe: Question about Saving Fonts. Pin
Johan Rosengren25-May-04 21:28
Johan Rosengren25-May-04 21:28 
GeneralHelp: How to retrieve UNIT of a scroll bar Pin
fotoONE25-May-04 3:57
fotoONE25-May-04 3:57 
GeneralRe: Help: How to retrieve UNIT of a scroll bar Pin
Maximilien25-May-04 4:19
Maximilien25-May-04 4:19 
Generalprivate member in base class problem Pin
kzyczynski25-May-04 3:52
kzyczynski25-May-04 3:52 
GeneralRe: private member in base class problem Pin
Maximilien25-May-04 3:55
Maximilien25-May-04 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.