Re: C programming on ARM




"Grant Edwards" <grante@xxxxxxxx> wrote in message news:13q21msqkij3dbb@xxxxxxxxxxxxxxxxxxxxx
On 2008-01-30, Wilco Dijkstra <Wilco_dot_Dijkstra@xxxxxxxxxxxx> wrote:

Actually most architectures are byte addressable, including ARM,

True, but many of them (ARM, SPARC, MSP430, ...) have alignment
requirements for objects larger than 1 byte in size.

Byte addressability refers to the smallest unit of addressability, not
to the coursest.

so casting pointers just works.

Unless the resulting pointer is misaligned.

Or the pointer is aligned but points to the wrong place, or invalid memory,
or a peripheral, or ... If you don't know what you're doing then pointer
casting is likely the least of your problems.

My point was that the bitpatterns of all pointer types are the same for
all addresses in the address space.

Wilco


.



Relevant Pages

  • Re: C programming on ARM
    ... True, but many of them (ARM, SPARC, MSP430, ...) have alignment ... Unless the resulting pointer is misaligned. ...
    (comp.arch.embedded)
  • Re: C programming on ARM
    ... Byte addressability refers to the smallest unit of ... assumed you meant it resulted in a pointer that could be ... Apparently you meant that it could be cast to ... someother type, then cast back to the original type and result ...
    (comp.arch.embedded)
  • Re: realloc() implicit free() ?
    ... block size as a request for one byte, and let the alignment mechanisms raise it as they will. ... is therefore suitably aligned for any type (`struct s' in particular), the value can be assigned to any type of pointer, and can then be used to access an object of that type. ... of the Standard can distort its meaning. ...
    (comp.lang.c)
  • Re: struct and union alignment
    ... > a char object requires only 1-byte alignment. ... I see no reason to require same alignment for types void* and char*, ... (Alignment requirements for character types are discussed ... See for yourself: in both cases "pointer ...
    (comp.lang.c)
  • Re: No dma_sync_* during pci_probe? (Sparc, post 2.6.22 regression)
    ... pci_device's or device's probe was finished. ... Would that be a bug in the Sparc platform code? ... a NULL iommu pointer or something like that. ... subsystem doesn't get as far on sparc64 on 2.6.23 and 2.6.24. ...
    (Linux-Kernel)