🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++
Article #388

Re: Isn't sizeof an operator?

#388
From: grunwald
Date: Tue, 21 Mar 1989 04:11
31 lines
1651 bytes
In article <9120@claris.com> hearn@claris.com (Bob Hearn) writes:

	....

   to the list of overloadable operators.  However, it would be much nicer
   if it used the dynamic rather than static information where appropriate,
   like class/structure element dereferencing!!  Are you listening, Bjarne???

   Unfortunately, for now, there seems to be no alternative but to keep track
   of the sizes yourself.  Not very helpful, I know, but at least correct. :-)

   Bob Hearn
   hearn@claris.com

And how should it do this? By sticking an extra field into every variable
structured item? How would this field be maintained?

Asking the compiler to keep this information is ``against the spirit of C++''.
You can do a much better job of it, and in those cases where you *don't*
want that information (i.e. usually), you don't pay for it.

What's wrong with having you base class have define `sizeOf' or something
and using that as a virtual function to determine size of things, as
OOPS & Libg++ do?



--
Dirk Grunwald
Univ. of Illinois
grunwald@flute.cs.uiuc.edu
Technical Details
Message-ID: <GRUNWALD.89Mar20221129@flute.cs.uiuc.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!mailrus!iuvax!uxc!garcon!garcon.cso.uiuc.edu!grunwald
References: <2352@buengc.BU.EDU> <8903202240.AA24954@yahi> <9120@claris.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!mailrus!iuvax!uxc!garcon!garcon.cso.uiuc.edu!grunwald
From: grunwald@flute.cs.uiuc.edu
Newsgroups: gnu.g++
Subject: Re: Isn't sizeof an operator?
Message-ID: <GRUNWALD.89Mar20221129@flute.cs.uiuc.edu>
Date: 21 Mar 89 04:11:29 GMT
References: <2352@buengc.BU.EDU> <8903202240.AA24954@yahi> <9120@claris.com>
Sender: news@garcon.cso.uiuc.edu
Distribution: gnu
Organization: University of Illinois, Urbana-Champaign
Lines: 31
In-reply-to: hearn@claris.com's message of 21 Mar 89 00:14:08 GMT