From -6443465715257071186
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,c503251d87cf889e
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-09-27 11:13:17 PST
Newsgroups: comp.std.c++
Path: bga.com!news.sprintlink.net!howland.reston.ans.net!EU.net!sunic!news.funet.fi!news.lut.fi!hilja.it.lut.fi!hevi
From: hevi@hilja.it.lut.fi (Petri Heinil{)
Subject: Re: size of a "empty" class
Sender: news@lut.fi (Usenet News)
Message-ID: <CwsvnD.GEz@lut.fi>
Date: Tue, 27 Sep 1994 18:06:49 GMT
References: <CwF0FH.5tB@ses.com> <CwG3BB.80M@world.std.com> <CwGBt9.2y0@cdf.toronto.edu>
Nntp-Posting-Host: hilja.it.lut.fi
Organization: Lappeenranta University of Technology, Finland
Lines: 43

In article <CwGBt9.2y0@cdf.toronto.edu>, g2devi@cdf.toronto.edu (Robert N. Deviasse) writes:
> In article <CwG3BB.80M@world.std.com>, Tom O Breton <tob@world.std.com> wrote:
> > ...
> >Your class is not empty. It has a hidden pointer to a virtual table.
> >Frankly, I don't think you understand what you are talking about here,
> 
> 
> Just because you can't currently see how something can be otherwise does not
> mean that it can't be so. 

Yes, for an example:

I want to do some image prosessing in OO way, I have type-class
Pixel, there is needed the 8 bit for 256 state gray scale. And
the protocol is defined something like show, calculate, etc. to the
manager object. And when I do for example edge detection, I need two classes
inherited from Pixel: a EdgePixel, that has a 8 states for the direction
where the egde goes and has different behaviour for show (the line) or
calculation, and the other class is NormalPixel that has standard pixel
behaviour. The EdgePixel are commonly minor number in calculated image.

And how I want get the edges from the 2048 x 2048 image, so if there
exist in compiler tagged optimization for virtual functions the size
likely needed is

	2048 * 2048 * 8 / 8  =  4 Mbytes

and if the are virtual pointer with the Pixel the size needed is

	2048 * 2048 * (8 + 40) / 8 = 20 Mbytes

that can't happen in normal machine (today) with 16 Mbytes ram.


The other question is does the compiler optimization rules
belongs to the standard definition, because they are partially
implementation issues. Alhough the C++ now posess the optimization
directives like "register" or "volatile", derived from the ANSI C.
And the C++ is low level language (it have pointers), so the
optimization might be appropriate.

-- 
-- <A HREF="http://www.lut.fi/~hevi/">The Page</A> --


