comp.lang.ada
 help / color / mirror / Atom feed
From: kilgallen@eisner.decus.org (Larry Kilgallen)
Subject: Re: Representation clauses and records
Date: 1997/12/16
Date: 1997-12-16T00:00:00+00:00	[thread overview]
Message-ID: <1997Dec16.061148.1@eisner> (raw)
In-Reply-To: 349646A2.1A013246@alphalink.com.au


In article <349646A2.1A013246@alphalink.com.au>, Pascal MALAISE <malaise@alphalink.com.au> writes:

> In C or ADA, you are likely to get a bus error or an unaligned access,
> more or less recovered by the operating system or your application :-(
> 
> This is because processors make assumptions about the addresses of given
> data types:
> character/byte - any address
> 16 bits "word" - address is a multiple of 2
> 32 bits "int"  - address is is a multiple of 4
> 64 bits "long" - address is a multiple of 8
> 
> When you declare your array of bytes/characaters, the compiler
> implements
> the array starting at any address. When you cast, the compiler will
> consider the new (integer) data as aligned and the processor will trap.

Whether the compiler (for any language) assumes that such variables
are aligned depends on the quality of the compiler and what you have
told it.

The DEC compilers for various languages on Alpha have many hooks for
indicating what assumptions should be made regarding alignment.  The
result is to tune the generated code between that which presumes worst
case alignment and that which presumes best case alignment.

Larry Kilgallen




  reply	other threads:[~1997-12-16  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <347000b1.4909762@news.geccs.gecm.com>
1997-11-21  0:00 ` Representation clauses and records Brian Nettleton
1997-11-21  0:00   ` Brian Nettleton
1997-11-24  0:00     ` Martin M Dowie
1997-11-25  0:00       ` Robert Dewar
1997-11-27  0:00         ` Martin M Dowie
1997-11-21  0:00   ` Matthew Heaney
     [not found]   ` <347a8dc3.3438484@news.geccs.gecm.com>
1997-11-25  0:00     ` Matthew Heaney
1997-12-16  0:00 ` Pascal MALAISE
1997-12-16  0:00   ` Larry Kilgallen [this message]
1997-12-17  0:00     ` Pascal MALAISE
1997-12-18  0:00       ` David J. Fiander
1997-12-18  0:00         ` Tucker Taft
1997-12-18  0:00         ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox