From: "Jon Bills" Newsgroups: comp.lang.c++,comp.os.msdos.djgpp Subject: Re: Holes in structure Date: Tue, 6 Nov 2001 15:13:43 +0000 (UTC) Organization: Mailgate.ORG Server - http://www.Mailgate.ORG Lines: 30 Message-ID: <639aa5bbb38a5a241a31b233b792f2cd.37623@mygate.mailgate.org> References: <3BE7D280 DOT C1732E58 AT bigfoot DOT com> <9s8o2d$nl6$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> NNTP-Posting-Host: 195.99.244.70 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.mailgate.org 1005039608 14372 195.99.244.70 (Tue Nov 6 16:13:43 2001) X-Complaints-To: abuse AT mailgate DOT org NNTP-Posting-Date: Tue, 6 Nov 2001 15:13:43 +0000 (UTC) Injector-Info: news.mailgate.org; posting-host=195.99.244.70; posting-account=37623; posting-date=1005039608 User-Agent: Mailgate Web Server X-URL: http://www.Mailgate.ORG To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Hans-Bernhard Broeker" wrote in message news:9s8o2d$nl6$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE... > [Crossposted without a proper F'up2 --- I restricted it to one group > as it should be] > > In comp.os.msdos.djgpp Alex Vinokur wrote: > [snip] > > Questions. > > 1. struct type0 (empty) : > > Why is 'sizeof' = 1? > > Why not? An empty struct is a completely useless thing --- what on > earth would you care about its size for? > [snip] It's not a completely useless thing in C++ - check out the x-posting. An empty struct (or class) has a size greater than zero so that it can have a distinct address. This allows arrays of objects with no data members to be created. Jon. -- Posted from [195.99.244.70] via Mailgate.ORG Server - http://www.Mailgate.ORG