From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 554 invoked by alias); 9 Jan 2008 23:50:34 -0000 Received: (qmail 545 invoked by uid 22791); 9 Jan 2008 23:50:33 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 23:50:07 +0000 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1JCkgN-0004eR-0S for ecos-discuss@sources.redhat.com; Wed, 09 Jan 2008 23:50:03 +0000 Received: from c-76-17-159-23.hsd1.mn.comcast.net ([76.17.159.23]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Jan 2008 23:50:03 +0000 Received: from grante by c-76-17-159-23.hsd1.mn.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Jan 2008 23:50:03 +0000 To: ecos-discuss@sources.redhat.com From: Grant Edwards Date: Wed, 09 Jan 2008 23:50:00 -0000 Message-ID: References: <7b2a34230801091355n355da963lce9b0264e1c99653@mail.gmail.com> <014701c8530d$ff055940$887ba8c0@PAULD> User-Agent: slrn/0.9.8.1 (Linux) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] Re: pragma pack X-SW-Source: 2008-01/txt/msg00036.txt.bz2 On 2008-01-09, Paul D. DeRocco wrote: >> From: Bronislav Gabrhelik >> >> Beware of bad alignment of timestamp field. Some processors >> might raise an exception/interrupt when you use the int like >> operation directly on field (including assignment & >> evaluation). You should copy out/in this by memcpy into/from >> temporary variable of the same type when you need to do some >> integer computing on this field. In other case your code >> might not be portable. > > I think that's the point of the __packed__ attribute: it > forces the compiler for any machine on which it matters to do > the necessary byte packing/unpacking automagically. I know > that's what the Gnu ARM compiler does. The trap snaps shut when you take the address of a field in a packed struct and pass that to somebody who's expecting a pointer to a normally aligned value. -- Grant Edwards grante Yow! I am covered with at pure vegetable oil and I am visi.com writing a best seller! -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss