Re: Size of class again
From: Tim Roberts (timr_at_probo.com)
Date: 02/04/04
- Next message: Nick Savoiu: "Re: Is Visual C++.NET also a reugular compiler?"
- Previous message: alex: "Re: Exiting process"
- In reply to: Jim: "Size of class again"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 03 Feb 2004 23:08:06 -0800
"Jim" <jimy_mystry@rediffmail.com> wrote:
>
>Iam putting my query again as i lost replies to my last messages. kindly
>look into my problem.
>
>Can someone please tell me . whats is the size of an empty class. How can i
>find the size of the class. Can someone suggest me some link where i can
>study abt the size of class. Like as soon as i create some variable inside a
>class how will the size get affected? In case of virtual methods how the
>size of class behaves.
This is trivially easy to learn by experimentation. Why didn't you just
try it?
C:\tmp>cat x.cpp
#include <stdio.h>
class abc { };
int main()
{
printf("sizeof(abc) = %d\n", sizeof(abc));
return 0;
}
C:\tmp>cl x.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
x.cpp
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:x.exe
x.obj
C:\tmp>.\x.exe
sizeof(abc) = 1
C:\tmp>
-- - Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc
- Next message: Nick Savoiu: "Re: Is Visual C++.NET also a reugular compiler?"
- Previous message: alex: "Re: Exiting process"
- In reply to: Jim: "Size of class again"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|