468,456 Members | 1,604 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,456 developers. It's quick & easy.

Size of an empty class why 1 byte ?

hello,
why sizeof an empty class why 1 byte ?

plz illustrate this ?
bye
Jul 22 '05 #1
4 4565
Sweety wrote:
why sizeof an empty class why 1 byte ?


Because if it weren't there would be no way to
distinguish between different objects in an array.

V
Jul 22 '05 #2
On 20 Aug 2004 12:56:34 -0700, sw************@yahoo.co.in (Sweety)
wrote:
hello,
why sizeof an empty class why 1 byte ?

plz illustrate this ?
bye


Everything must have a different address in memory, otherwise there
are big possibilities for confusion with pointers, references and
suchlike. Hence even an empty class takes up one byte so the next
thing you declare will have a different address.

rossum

--

The ultimate truth is that there is no Ultimate Truth
Jul 22 '05 #3
On 21 Aug 2004 01:00:41 GMT, da*********@aol.com (DaKoadMunky) wrote:
http://www.research.att.com/~bs/bs_f...l#sizeof-empty


[mode = modesty NOT]Nice to see that Bjarne agrees with me.[/mode]

rossum

--

The ultimate truth is that there is no Ultimate Truth
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by pembed2003 | last post: by
8 posts views Thread by ishekara | last post: by
6 posts views Thread by free2cric | last post: by
8 posts views Thread by ypjofficial | last post: by
2 posts views Thread by Harish | last post: by
1 post views Thread by Ajay | last post: by
7 posts views Thread by Ajay | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.