<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 14 Mar 2013, at 01:48, Xiangrong Fang 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; ">The document said it is "deprecated"? Also, I want this to be cross<br>platform, not for unix only. The use case is:<br><br>try<br> buf := GetMemory(1024);<br> size := 10240;<br> stream.Read(buf^, size);<br>except<br> ??<br>end;<br></span></span></blockquote></div><br><div>That use case is a textbook example of why you should never try to catch and handle access violations, except possibly if you then warn the user that anything could happen if he continues (including erasing all files on his hard drive, if he's very unlucky).</div><div><br></div><div>An access violation often indicates that memory has been corrupted. Catching the access violation does not undo the memory corruption, it just informs you about this fact. If you continue after catching the exception in the above program, you will be working with corrupted memory, which means that the behaviour of your program becomes completely unpredictable afterwards.</div><div><br></div><div><br></div><div>Jonas</div></body></html>