Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Exception on unaligned access

2004-10-06 by Robert Adsett

At 09:36 PM 10/5/04 -0400, you wrote:

>* Robert Adsett <subscriptions@...>:
> > But it raises the question.  What kind of code
> > are you writing where this is more than a very
> > occasional issue?
>
>We are porting code from Intel/Linux to ARM.
>Packed structures are causing the problems. There
>are many throughout the code and we are busy
>fixing them all but we are worried we might miss
>some and not realize it until it's too late.

OK, I partly understand that.  But if the code is self contained (no 'disk' 
storage, no net communications) doesn't GCC have a switch to turn off 
unaligned access globally?  Certainly something like lint will catch it 
(I'm pretty sure PC-Lint will, along with a horde of other sins).

If you are communicating via disk or communications then all the I/O should 
go through a single interface and be translatable there.  Of course that's 
the ideal and it would hardly be surprising (unfortunately) to see the 
cardinal sin of fwrite(  &struct, sizeof( struct), 1 file) sprinkled 
willy-nilly and used to generate the standard file format.  In this case I 
don't think there is a shortcut other than finding (hopefully in a central 
location) and rewriting the I/O in a portable fashion.

As a wise man once said "The definition of portable code is code that has 
been ported."

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.