Re: alignment of data-types

"Glen Herrmannsfeldt" <>
6 Feb 2003 00:16:31 -0500

          From comp.compilers

Related articles
Re: alignment of data-types (Glen Herrmannsfeldt) (2003-02-06)
RE: alignment of data-types (Onder Karpat) (2003-02-11)
Re: alignment of data-types (2003-02-11)
Re: alignment of data-types (Mark McIntyre) (2003-02-11)
Re: alignment of data-types (Glen Herrmannsfeldt) (2003-02-12)
| List of all articles for this month |

From: "Glen Herrmannsfeldt" <>
Newsgroups: comp.lang.c,comp.compilers
Date: 6 Feb 2003 00:16:31 -0500
Organization: AT&T Broadband
References: <3e3fbe78$0$49117$> <>
Keywords: architecture, practice
Posted-Date: 06 Feb 2003 00:16:31 EST

"Mark McIntyre" <> wrote in message
> On Tue, 4 Feb 2003 14:22:00 +0100, in comp.lang.c , "R.A. Scheltema"
> <> wrote:
> >I'm currently working on a project which needs a lot of optimazation.
> >been reading some stuff on aligning data-types, which would mainly be
> >important for avoiding cach-splits and some other preformance
> The first rule of optimisation is - don't do it yet.
> The second rule is - optimise the ALGORITHM first not the code.
> The sort of stuff you're talking about is very low level and should be
> done automatically by any good optimising compiler.
> You have little or no chance of being better at it than the guys who
> wrote it, at least not till you're a guru programmer, by which stage
> you won't need to ask us for advice....

Should, but not always true.

It is common for x86 compilers to allocate double variables on 4 byte
boundaries. This was optimal on the 386 and 486, but not on pentium
and later processors. The difference can be large.

I now added comp.compilers because I didn't think of a better place to
discuss the properties of a large number of compilers on different
systems. It might be nice to know which allocate on 4 and which on 8
byte boundaries.

-- glen

Post a followup to this message

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