Re: alignment of data-types

"Glen Herrmannsfeldt" <gah@ugcs.caltech.edu>
12 Feb 2003 13:39:28 -0500

          From comp.compilers

Related articles
Re: alignment of data-types gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-02-06)
Re: alignment of data-types anton@mips.complang.tuwien.ac.at (2003-02-11)
Re: alignment of data-types markmcintyre@spamcop.net (Mark McIntyre) (2003-02-11)
Re: alignment of data-types gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-02-12)
| List of all articles for this month |

From: "Glen Herrmannsfeldt" <gah@ugcs.caltech.edu>
Newsgroups: comp.lang.c,comp.compilers
Date: 12 Feb 2003 13:39:28 -0500
Organization: AT&T Broadband
References: <3e3fbe78$0$49117$e4fe514c@news.xs4all.nl> <u6i04vgrps4ar212a1s8knie78jm193e63@4ax.com> 03-02-033 03-02-054
Keywords: architecture, performance
Posted-Date: 12 Feb 2003 13:39:27 EST

"Mark McIntyre" <markmcintyre@spamcop.net> wrote in message
> On 6 Feb 2003 00:16:31 -0500, in comp.lang.c , "Glen Herrmannsfeldt"
> <gah@ugcs.caltech.edu> wrote:
>
> >"Mark McIntyre" <markmcintyre@spamcop.net> wrote in message
> >> 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.
>
> Indeed. But by the time hte OP truly understands why that is so, he
> for sure won't need to ask questions in CLC. Hence the 2nd part of my
> remark.


True, but even worse is doing profiling and having the alignment change
accidentally.


The one I was originally writing about is the pointer returned by malloc().
Structure alignment is a different question. malloc() alignment could
easily change with only a small change in a program, or even no change at
all.


-- glen


Post a followup to this message

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