[fpc-devel] alignment warnings

Martin lazarus at mfriebe.de
Fri Sep 30 11:52:18 CEST 2011


On 30/09/2011 10:44, Henry Vermaak wrote:
> Hi list
>
> Thinking more about the alignment problems on arm and elsewhere, I was 
> wondering how hard it would be to implement something like gcc's 
> -Wcast-align.  Here's a description from the man page:
>
> Warn whenever a pointer is cast such that the required alignment of 
> the target is increased.  For example, warn if a "char *" is cast to 
> an "int *" on machines where integers can only be accessed at two- or 
> four-byte boundaries.

Why limit it to "on machines where ... can only be accessed at ... 
boundaries".
If code is written for multiply platforms, then the implementor may be 
on a machine where the cast is allowed, and needs no warning, but soon 
as the code is compiled on a different architecture, the warnings come up.
It would be good, if one could also enable warnings for code, that may 
have issues on other platforms



More information about the fpc-devel mailing list