<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 06 Dec 2012, at 14:03, Martin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">Yet what I do not understand, is why I get that message as warning (as opposed to a hint). If I understand it right (I have not tested, maybe it gives a warning on 64 bit target too, if so ignore the rest), and I compile for a 64bit target, then it downgrades to a hint again?<br></span></span></blockquote><div><br></div><div>Yes. If you typecast an integer to a pointer and both have the same size, you get a hint. If they have a different size, you get a warning.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">The only difference is, that in the above example, if compiled for a 32 bit system, I already may have broken code. But then what it actually means is that I should get warning about a truncating the value.<br><br> b := byte(a);<br>Gives no warning at all.<br></span></span></blockquote><div><br></div><div>That's because truncating integers cannot result in invalid addresses. The warning was added to help people moving from 32 bit to 64 bit systems and using longint typecasts in their programs to convert between addresses and integers. There are very few cases whereby discarding the upper 32 bit of a pointer is intended or results in valid code.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">It also truncates the warning. What is then special about potentially truncating a value by using pointer(a)? If "pointer(a)" is worth a warning (instead of a hint, why isn't byte(a)?<br></span></span></blockquote></div><br><div>Because there never was a migration from a system whereby int64 was the same size as a byte and now it isn't anymore, and there are many common cases whereby discarding part of an integer value is part of an algorithm.</div><div><br></div><div><br></div><div>Jonas</div><div><br></div><div><br></div></body></html>