RFH: aliasing problems

Thomas Doerfler Thomas.Doerfler at embedded-brains.de
Wed Dec 13 07:39:37 UTC 2006


Steven Johnson schrieb:

>> Steven, it seems you still miss the meaning of aliasing rules, so all the
>> suggestions you give are just tricks to silence compiler warnings, not
>> actual fixes to the problems.
> Please enlighten me as to the meaning of the aliasing rules, in a way 
> that makes sense given the other parts of the specification with regard 
> to permissible pointer conversion.  I would be overjoyed to be 
> enlightened on this matter. 

Steven, i agree with Sergei's statements. In the beginning I was also
confused with the "pointer conversion rules" you mentioned, because they
do not match the aliasing rules.

But I think from a user's point of view it means, that you are allowed to:
-  assign pointers of one type to pointers of a different type according
to conversion rules.

- You can perform pointer math (increment, decrement, compute the
difference between two pointers) according to these rules

- But you are NOT allowed to access the memory objects through a
type-converted pointer, because this WILL break the aliasing rules.

There are not too many ways where pointer conversion still makes sense,
but things are restricted in C99.


> Steven J
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users

embedded brains GmbH
Thomas Doerfler           Obere Lagerstr. 30
D-82178 Puchheim          Germany
Tel. : +49-89-18 90 80 79-2
Fax  : +49-89-18 90 80 79-9
email: Thomas.Doerfler at embedded-brains.de
PGP public key available on request

More information about the users mailing list