Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: For C Experts

2006-03-30 by jayasooriah

Dave,

To us the unaligned pointer assignment is obvious when we look at it
in context.

To the compiler, that line alone is not enough to say that assignment
is invalid.  For example, it is a perfectly valid if the value of "i"
is a multiple of four in your example.

Sometimes pointers are used to pass information which are not valid
pointers (but as an escape to the norm) and these pople would be
crossed if compilers did not allow them to do this.

Jaya

--- In lpc2000@yahoogroups.com, "dsidlauskas1" <dsidlauskas@...> wrote:

> The information to the compiler is in the line:
> 
>  ip = (int *)&buf[i];
> 
> Where it should be clear that the pointer is to an unaligned int.
> 
> Dave S.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.