Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!pacbell!ames!ll-xn!mit-eddie!uw-beaver!uw-june!uw-entropy!dataio!pilchuck!ssc!happym!polari!rlb From: rlb@polari.UUCP (rlb) Newsgroups: comp.lang.c++ Subject: classes with no data members Message-ID: <464@polari.UUCP> Date: 31 May 88 15:25:43 GMT Article-I.D.: polari.464 Organization: Polarserv, Seattle WA Lines: 28 In the July, 1987 "The C++ Programming Language": Chapter 7, section 7, for such a small section, contains quite a lot of facts about the language. The concept of a class that has no data (as opposed to function) members is a stumbling-block for me. Actually, I thought I understood it until this section pointed out that you can have a non-NULL pointer to such a class. I have some questions: a) What the heck should a pointer to such a class point to? b) Should the "sizeof" such a class be zero? c) If the "sizeof" such a class is zero and I use "new" to create an object of that class, should the amount of free store decrease? d) The proposed ANSI standard does not guarantee whether its storage allocators return NULL or not for objects of size zero. Should C++ guarantee the behavior of the default implementation of "new" when asked to allocate zero bytes? e) If I declare an "auto" array of objects of such a class, should it consume any stack space? Notice that the above questions say "should" and not "does"; I am not really interested in what particular implementations do, but rather what the language definition is (or should be). -Ron Burk