home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
- From: tmb@arolla.idiap.ch (Thomas M. Breuel)
- Newsgroups: comp.lang.c++
- Subject: Re: zero-length datatype
- Message-ID: <TMB.92Sep12212903@arolla.idiap.ch>
- Date: 13 Sep 92 01:29:03 GMT
- References: <23654@alice.att.com> <1992Sep11.185505.17536@cadsun.corp.mot.com>
- <23659@alice.att.com>
- Sender: news@ai.mit.edu
- Reply-To: tmb@idiap.ch
- Distribution: comp
- Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
- Perceptive)
- Lines: 26
- In-reply-to: ark@alice.att.com's message of 12 Sep 92 15:54:04 GMT
-
- In article <23659@alice.att.com> ark@alice.att.com (Andrew Koenig) writes:
-
- In article <1992Sep11.185505.17536@cadsun.corp.mot.com> shang@corp.mot.com writes:
-
- > That is why ISO C standard does not allow empty structure and zero
- > number of array.
-
- No, ISO C does allow empty structures. It just says that they must
- occupy a non-zero amount of memory.
-
- > But I don't see the reason why we can't have zero-size objects. Don't
- > say that the standard explicitly says that. I want to know why it says
- > that. So far, I haven't heard any convincing argument.
-
- I don't really know why. What I do know is that the presence of
- that requirement in the C standard makes it hard to avoid the same
- requirement in the C++ standard.
-
- Well, it might be good to remain compatible, in the sense that every
- object that has non-zero size in ISO C also have a non-zero size in
- C++. However, since there are no objects of type "void" (or of some
- other, newly introduced, distinguished type with zero size) in ISO C,
- there can't be any harm in letting objects of this new type have zero
- size: the behavior of existing code would not be affected.
-
- Thomas.
-