Re: Size of class again

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tim Roberts (timr_at_probo.com)
Date: 02/04/04


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


Relevant Pages

  • Size of class again
    ... Iam putting my query again as i lost replies to my last messages. ... whats is the size of an empty class. ...
    (microsoft.public.vc.language)
  • Re: Excel 2007 data query parameter issue
    ... Welcome to Microsoft Newsgroup Support Service! ... in the Microsoft Query, so our question is: how to add a parameter to the ... This will start up the Query Wizard by default, ...
    (microsoft.public.excel.programming)
  • RE: LDAP query for xerox 3545 printer/scanner blocked by SBS 2003?
    ... I am able to query the LDAP successfully from the second workstation but not ... Microsoft CSS Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ... Step2:Please ensure the DNS on workstation is pointed to SBS server. ...
    (microsoft.public.windows.server.sbs)
  • Re: Incomplete results returned
    ... George Cheng ... Microsoft Application Center & Index Server Support ... | simple query ... | the page logo, ...
    (microsoft.public.inetserver.indexserver)
  • RE: Using Index Server
    ... Microsoft Application Center & Index Server Support ... |>' *** Modifying the Form Logo: ... |>' *** Modifying the Number of Returned Query Results. ...
    (microsoft.public.inetserver.indexserver)