Re: C programming on ARM
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Wed, 30 Jan 2008 19:24:23 -0500
Paul Keinanen wrote:
CBFalconer <cbfalconer@xxxxxxxxx> wrote:.... snip ...
Jim Relsh wrote:
Or cast to the correct type (if you are sure and know what
you're doing).
Caution. Most pointer casts are implementation defined. The
exception is casting to and from void*, and from void* back to
the original type.
In which case would an arbitrary pointer casting be a problem ?
The only situation I can think of is for instance some DSP with
24 bit addressable unit or some old 36 bit mainframe, in which
for instance a char* would require the memory word and also
information which quarter word is referenced.
With any byte addressable architecture, a pointer is just a
pointer.
No. Pointers also carry (or imply) information about the object
type, including alignment requirements. Misaligned access to an
item can cause all sorts of unwelcome reactions.
One thing you can do is cast a pointer to an unsigned char*. But
not the reverse. Note that you can't dereference a void*.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
.
- References:
- C programming on ARM
- From: aamer
- Re: C programming on ARM
- From: Arlet Ottens
- Re: C programming on ARM
- From: Jim Relsh
- Re: C programming on ARM
- From: CBFalconer
- Re: C programming on ARM
- From: Paul Keinanen
- C programming on ARM
- Prev by Date: Re: C programming on ARM
- Next by Date: Re: C programming on ARM
- Previous by thread: Re: C programming on ARM
- Next by thread: Re: C programming on ARM
- Index(es):
Relevant Pages
|