Re: Data Structure Reorganizing Optimizations

stripes@uunet.uu.net (Josh Osborne)
Thu, 27 Oct 1994 04:49:52 GMT

          From comp.compilers

Related articles
CProf cache profiling system available david@cs.wisc.edu (1994-10-13)
Data Structure Reorganizing Optimizations [Was: Re: CProf cache profil glew@ichips.intel.com (1994-10-19)
Re: Data Structure Reorganizing Optimizations john@iastate.edu (1994-10-22)
Re: Data Structure Reorganizing Optimizations robertb@HING.LCS.MIT.EDU (1994-10-26)
Re: Data Structure Reorganizing Optimizations johnm@cory.EECS.Berkeley.EDU (1994-10-22)
Re: Data Structure Reorganizing Optimizations stripes@uunet.uu.net (1994-10-27)
Re: Data Structure Reorganizing Optimizations bret@icicle.winternet.com (1994-10-23)
Data Structure Reorganizing Optimizations leichter@zodiac.rutgers.edu (1994-10-31)
Re: Data Structure Reorganizing Optimizations yuri@shimari.cmf.nrl.navy.mil (1994-10-31)
Re: Data Structure Reorganizing Optimizations ddg@cci.com (1994-10-31)
Re: Data Structure Reorganizing Optimizations amos@nsof.co.il (1994-11-01)
Re: Data Structure Reorganizing Optimizations pardo@cs.washington.edu (1994-10-31)
[15 later articles]
| List of all articles for this month |
Newsgroups: comp.arch,comp.compilers
From: stripes@uunet.uu.net (Josh Osborne)
Keywords: optimize
Organization: UUNET Technologies, Inc. (Earth offices)
References: 94-10-108 94-10-141
Date: Thu, 27 Oct 1994 04:49:52 GMT

Andy Glew <glew@ichips.intel.com> wrote:
[...]
>I am aware of the K&R rule that structure elements be in increasing
>order of address. But, since the contiguity requirement has been
>dropped, and since different machines have different padding rules,
>what value does the address ordering rule have? Even network header
>code cannot be written portably using structures to access data
>structures placed in memory from DMA devices.
>
>I believe that C's rules about data structure organization are
>obsolete. Certainly, they are not in the ken of the usual programmer
>using C or C++. Why not permit compilers to do such "illegal" data
>structure reorganizations, bringing the performance gains Lebeck and
>Wood describes to the standard application?


Have you ever seen code like this:


struct type1 {
    int a;
    char *b;
    char *c;
};


struct type2 {
    int a;
    float b;
    char * c;
};


union foo {
    type1 t1;
    type2 t2;
};


Then code looks at "foo.t1.a" to decide if foo is of type t1 or t2?
I beleve this sort of thing is at least somewhat common. I also think
Xlib does it (with the event structure). This may also be legal without
the union, but I find that distasteful (of corse I'm not real happy with
the union either...).


>I suggest that this be considered by future X3J11 ANSI C standards (if
>any such revisions are forthcoming).


Remember to deal with union's.
--


Post a followup to this message

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