[m-dev.] Re: pragma fact_table
Fergus Henderson
fjh at cs.mu.oz.au
Wed Feb 19 14:38:10 AEDT 1997
Tyson Richard DOWD, you wrote:
>
> >
> > For the case when index is a pointer, is it guaranteed to be aligned
> > on a word boundary (i.e. so that at least the 2 least significant bits
> > are 0)? The pointer is pointing to a struct defined as a global C
> > variable, not to something on the Mercury heap.
>
> Sure hope so, since a lot of my code relies on it.
Does it? I thought you were being a good boy and #if'ing such assumptions.
(Well, actually I wasn't sure about the good boy part... ;-)
I sure hope your code works with `NUM_TAG_BITS == 0'!
> On the alphas and sparcs, this is definitely true - you'll get a bus error if
> you try to dereference a pointer that is not aligned. On the x86, this
> is not necessarily true, because instruction size is not fixed as 32
> bits (ah 8086, how we loved thee too much). However, I think Linux
> (and most OSs) enforce (or at least assume) this at an OS level.
It's not enforced by Linux, and I don't think it is assumed by Linux
either. It's the compilers that determine it, not the OS. Most modern
x86 compilers align things, but Borland C/C++ still does not align
structures by default, for binary backwards compatibility with Turbo C
1.0 or something like that. (Borland C/C++ does have an option to
enable alignment, however.)
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list