home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!panther!mothost!motsrd!news
- From: shang@corp.mot.com (David (Lujun) Shang)
- Subject: Re: zero-length datatype
- Message-ID: <1992Sep14.152627.6690@cadsun.corp.mot.com>
- Sender: news@cadsun.corp.mot.com
- Reply-To: shang@corp.mot.com
- Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
- References: <BuFx0t.IFA@intime.intime.COM>
- Distribution: comp
- Date: Mon, 14 Sep 92 15:26:27 GMT
- Lines: 39
-
- In article <BuFx0t.IFA@intime.intime.COM> scottm@intime.intime.COM (Scott
- Michel) writes:
- > However, it's clear that the reason why C++ doesn't allow one to have
- > a zero length object is that all instances of objects must be unique.
-
- An empty object has no state. You are not necessary to distinguish one
- empty object from the other. If a class can instantiate distinguished
- objects, it must be a non-empty class.
-
- > This is a Reasonable Thing, otherwise you'd end up with real confusion
- > in the language as to whether or not an object is really a stand-in or
- > alias for another, and whether or not the object exists in the first
- > place.
-
- Since you are not neccessary to distinguish non-state objects, you are
- not neccessary to distinguish whether a non-state object is a stand-in
- or alias. With zero-length assumption, you can still use object address
- in implementation to judge whether such an object exists (newed with
- initialization). But again, you can not, nor need, using object address
- to ditinguish them from one to other.
-
- > Is one zero-length object itself or a meta object for another?
-
- C++ has not meta-object. If an object has an ditinguishable meta object,
- it does have states.
-
- > According to Aristotle's theory of classes (and his philosophy as a whole)
- > you'd force yourself into a situation where something can be itself and
- > not itself similtaneously.
-
- In fact, an empty class only has a single object instance. Therefore,
- when I say we need not distinguish non-state objects, they are still
- distinguishable. It does not violate Aritotle's class thoery. We
- should distinguish the storage that holds the object and the object
- itself. We cannot distinguish non-state object through its storage,
- since it occupies no storage.
-
- David Shang
-
-