By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,822 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

Size of an empty class why 1 byte ?

P: n/a
hello,
why sizeof an empty class why 1 byte ?

plz illustrate this ?
bye
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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.