473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How is the size of a class computed ?

Hi !

How is the size of a class computed ?

Suppose I have the class:
class CTest
{
public:
CTest(void) {}
virtual ~CTest(){}
operator int() const {return 0;}
};
The class has no attributes. What should the sizeof (CTest) return ?
Is there a rule or is it completely system dependent ?

Regards,
Razvan
Jul 22 '05 #1
2 1006

"Razvan" <mi*****@mailcity.com> wrote in message
news:15**************************@posting.google.c om...
Hi !

How is the size of a class computed ?

Suppose I have the class:
class CTest
{
public:
CTest(void) {}
virtual ~CTest(){}
operator int() const {return 0;}
};
The class has no attributes. What should the sizeof (CTest) return ?
Is there a rule or is it completely system dependent ?


It will not return zero. Apart from that it is system dependent.

john
Jul 22 '05 #2

"Razvan" <mi*****@mailcity.com> wrote in message
news:15**************************@posting.google.c om...
Hi !

The class has no attributes. What should the sizeof (CTest) return ?
Is there a rule or is it completely system dependent ?


No, implementation defined.
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: skeeterbug | last post by:
please see http://www.geocities.com/operationsengineer1/test.htm for an idea of how i want my logo header div to be layed out. when i went to resize "Test" to 2em (from 1em), this is what...
30
by: Neil Zanella | last post by:
Hello, Suppose I have some method: Foo::foo() { static int x; int y; /* ... */ }
1
by: GJK | last post by:
In SQL Sever, do the size of computed columns gets added to the total size of the tables? Does SQL server stores the actual values in computed columns? Thanks _GJK
1
by: SleepSheep | last post by:
two struct in c# public class A { int i1; byte i2; }
40
by: Paul Davis | last post by:
Hi all, I'm building some style sheets and trying to play the old game of balancing designer pixel perfection and still allowing users to adjust their font sizes. The compromise I've made with the...
24
by: Harris Kosmidis | last post by:
I have a site up and running (www.solsoft.gr). I tested it with FF2 and IE6 and works ok with some IE hacks. Ok the CSS isn't good cause I started designing it with another look and the customer...
30
by: Takehiko Abe | last post by:
I have a <pelement with <ttinside: ;;; <p>A paragraph contains <tt>tt element</tt>.</p> I would like to set the font-size of the TT to the same as the containing <p>. This does not seem to...
13
by: globalrev | last post by:
wassup here? 7 Traceback (most recent call last): File "C:\Python25\myPrograms\netflix\netflix.py", line 22, in <module> print cust1.getID() AttributeError: 'NoneType' object has no...
36
by: Roedy Green | last post by:
The only browser I have encountered that supports <colgroup><col class="behold"></colgroup> to apply a CSS style to a whole column, is Microsoft Internet Explorer. I have been told it SHOULD NOT...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.