Re: Optimizing structure layout

tl@funcom.com (Torbjorn Lindgren)
31 Mar 1997 15:22:42 -0500

          From comp.compilers

Related articles
Optimizing structure layout erik.schnetter@student.uni-tuebingen.de (1997-03-21)
Re: Optimizing structure layout dolby@cs.uiuc.edu (Julian Dolby) (1997-03-22)
Re: Optimizing structure layout fjh@mundook.cs.mu.OZ.AU (1997-03-22)
Re: Optimizing structure layout cdg@nullstone.com (Christopher Glaeser) (1997-03-22)
Re: Optimizing structure layout meissner@cygnus.com (Michael Meissner) (1997-03-27)
Re: Optimizing structure layout dlmoore@ix.netcom.com (David L Moore) (1997-03-27)
Re: Optimizing structure layout tl@funcom.com (1997-03-31)
Re: Optimizing structure layout pieper@zko.dec.com (John Pieper) (1997-03-31)
Re: Optimizing structure layout bonnardv@pratique.fr (Valentin Bonnard) (1997-03-31)
| List of all articles for this month |

From: tl@funcom.com (Torbjorn Lindgren)
Newsgroups: comp.compilers
Date: 31 Mar 1997 15:22:42 -0500
Organization: Funcom Oslo AS
References: 97-03-130 97-03-157
Keywords: storage, optimize, C++

erik.schnetter@student.uni-tuebingen.de writes:
>> While it is quite common that compilers optimize the code they
>> produce, I haven't heard of a commonly used system that really
>> optimizes the layout of the data structures that are generated. Are
>> there such systems?


Michael Meissner <meissner@cygnus.com> wrote:
>For many languages, it is impossible. C for one requires that
>structure members be laid out in the order the programmer wrote them.
>I believe C++ allows classes to be optimized, but again, not
>structures.


There's very little differences between classes and structs in C++.


You aren't allowed to optimize POD-classes, and all ANSI C classes
fits the criterias for being POD-classes (likwise for ANSI C unions
and POD unions). Note however that I *suspect* that you can have
POD-classes too, and I also suspect that if they do exist you aren't
allowed to optimize these either.


In fact, the only difference I can think of between classes and
struct's in C++ I can think of is that the visibility is different by
default (private respective public). It's somewhat uncommon to see
advanced struct's (with member functions, and private struct parts),
but they are perfectly valid C++.


--
Torbjörn Lindgren
E-mail: tl@funcom.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.