[m-dev.] Re: pragma fact_table

Tyson Richard DOWD trd at students.cs.mu.oz.au
Wed Feb 19 14:29:53 AEDT 1997


> 
> 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.

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.

-- 
       Tyson Dowd           # "Most people's C code should be indented
                            #  six feet downward and covered with 
     trd at cs.mu.oz.au        #  dirt."
http://www.cs.mu.oz.au/~trd # - Blair Houghton, on C code indentation



More information about the developers mailing list