Adriaan van Os wrote:
The same remarks apply for
theBytePtr:= BytePtr( theIntPtr); IntPtr( theBytePtr):= theIntPtr; {testcast.pas:14: warning: cast increases required alignment of target type}
but then the other way round.
It's more tricky to suppress the warning here since at the time the cast is built, the compiler doesn't know whether it will be used on the LHS or RHS. And since there's an easy alternative (RHS cast) available which is even preferable (LHS casts generally are a strange beast) and a compiler directive to turn of the alignment warnings, I don't think we need to bother.
OK, but I suggest to change the wording to "cast may increase required alignment of target type".
I understand what you aim at, but the suggested wording may not be quite accurate -- the alignment is increased in any case, but whether that's bad or not depends on the situation, hmm ...
Frank