writing value to pointer
From: Frank Benoit (nospam_at_xyz.com)
Date: 07/17/03
- Next message: Paul Pluzhnikov: "Re: writing value to pointer"
- Previous message: Trevor Barton: "Re: Have ext3 on SanDisk CF but can't disable write-back caching as kernel instructs"
- Next in thread: Paul Pluzhnikov: "Re: writing value to pointer"
- Reply: Paul Pluzhnikov: "Re: writing value to pointer"
- Reply: Blane Bramble: "Re: writing value to pointer"
- Reply: Michael Schnell: "Re: writing value to pointer"
- Reply: Tauno Voipio: "Re: writing value to pointer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 17 Jul 2003 15:30:33 +0200
On ARM with GCC 2.95.3:
typedef unsigned char uint8;
typedef unsigned short uint16;
uint8 buffer[100];
uint16 * ptr0 = ( uint16 * ) & buffer[0];
uint16 * ptr1 = ( uint16 * ) & buffer[1];
uint16 * ptr2 = ( uint16 * ) & buffer[2];
*ptr0 = 0x1234; // OK, writes into buffer[0-1]
*ptr1 = 0x1234; // Error, writes into buffer[0-1]
*ptr2 = 0x1234; // OK, writes into buffer[2-3]
//------------------------------------
How can I force the compiler to generate code, that works correct?
Frank
benoit at tionex de
- Next message: Paul Pluzhnikov: "Re: writing value to pointer"
- Previous message: Trevor Barton: "Re: Have ext3 on SanDisk CF but can't disable write-back caching as kernel instructs"
- Next in thread: Paul Pluzhnikov: "Re: writing value to pointer"
- Reply: Paul Pluzhnikov: "Re: writing value to pointer"
- Reply: Blane Bramble: "Re: writing value to pointer"
- Reply: Michael Schnell: "Re: writing value to pointer"
- Reply: Tauno Voipio: "Re: writing value to pointer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|