home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13618 < prev    next >
Encoding:
Text File  |  1992-09-14  |  2.2 KB  |  53 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!panther!mothost!motsrd!news
  3. From: shang@corp.mot.com (David (Lujun) Shang)
  4. Subject: Re: zero-length datatype
  5. Message-ID: <1992Sep14.152627.6690@cadsun.corp.mot.com>
  6. Sender: news@cadsun.corp.mot.com
  7. Reply-To: shang@corp.mot.com
  8. Organization: Motorola, Inc., Software Research and Development, Rolling Meadows, IL. 60008
  9. References: <BuFx0t.IFA@intime.intime.COM>
  10. Distribution: comp
  11. Date: Mon, 14 Sep 92 15:26:27 GMT
  12. Lines: 39
  13.  
  14. In article <BuFx0t.IFA@intime.intime.COM> scottm@intime.intime.COM (Scott  
  15. Michel) writes:
  16. > However, it's clear that the reason why C++ doesn't allow one to have
  17. > a zero length object is that all instances of objects must be unique.
  18.  
  19. An empty object has no state. You are not necessary to distinguish one 
  20. empty object from the other. If a class can instantiate distinguished 
  21. objects, it must be a non-empty class.
  22.  
  23. > This is a Reasonable Thing, otherwise you'd end up with real confusion
  24. > in the language as to whether or not an object is really a stand-in or
  25. > alias for another, and whether or not the object exists in the first
  26. > place. 
  27.  
  28. Since you are not neccessary to distinguish non-state objects, you are 
  29. not neccessary to distinguish whether a non-state object is a stand-in 
  30. or alias. With zero-length assumption, you can still use object address 
  31. in implementation to judge whether such an object exists (newed with 
  32. initialization). But again, you can not, nor need, using object address 
  33. to ditinguish them from one to other.
  34.  
  35. > Is one zero-length object itself or a meta object for another?
  36.  
  37. C++ has not meta-object. If an object has an ditinguishable meta object, 
  38. it does have states.
  39.  
  40. > According to Aristotle's theory of classes (and his philosophy as a whole)
  41. > you'd force yourself into a situation where something can be itself and
  42. > not itself similtaneously. 
  43.  
  44. In fact, an empty class only has a single object instance. Therefore, 
  45. when I say we need not distinguish non-state objects, they are still
  46. distinguishable. It does not violate Aritotle's class thoery.  We 
  47. should distinguish the storage that holds the object and the object 
  48. itself. We cannot distinguish non-state object through its storage, 
  49. since it occupies no storage.
  50.  
  51. David Shang
  52.  
  53.