This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: Address assignment
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Paul Koning'" <pkoning at equallogic dot com>
- Cc: <dj at redhat dot com>,<shreyas76 at gmail dot com>,<binutils at sources dot redhat dot com>
- Date: Wed, 14 Sep 2005 20:37:00 +0100
- Subject: RE: Address assignment
----Original Message----
>From: Paul Koning
>Sent: 14 September 2005 20:23
>>>>>> "Dave" == Dave Korn <dave.korn@artimi.com> writes:
>
> >> Why add an unneeded level of indirection? Especially on
> >> time-critical embedded systems?
>
> Dave> These days, I really have *lots* of faith in the compiler to be
> Dave> able to optimise that away[*]. But I guess you could always
> Dave> write
>
> Dave> #define my_struct (*(struct my_struct_type *)0xa0001028)
>
> Dave> and treat it just like an object
>
> Dave> my_struct.x = 3;
>
> If you don't want accesses optimized away, you need "volatile".
>
> paul
You've missed the point. I _do_ want accesses optimised away. Accesses
to the pointer variable; not accesses to the thing it points at. Yes, for
most memory-mapped h/w, you would want the object to be volatile. But you
and I are talking about things on opposite sides of the '*':
volatile my_struct_type * const my_struct_ptr = blablablaaaa;
cheers,
DaveK
--
Can't think of a witty .sigline today....