<!DOCTYPE html><html><head>
<style type="text/css">body { font-family:'宋体'; font-size:13px}</style>
</head>
<body>在 Tue, 04 Dec 2012 02:42:38 +0800,Tim Čas &lt;darkuranium@gmail.com&gt; 写道:<br><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex">Well, as stated, you can just compute that by yourself without the parameter. Look at the code on SO.com again -- it *does* use the parameter -- it uses it to compute the final position.<br><br>I'm not the maintainer of the library, but I think it would be a *very* bad idea to add a redundant feature for something which can be gotten around so easily.<br>
<br>And since fseek() cannot work with negative indices, why should this? I don't see why it couldn't be so simple (or even simpler -- ignore this case as it won't happen anyways).<br>In either case, what should be read anyways if you try to seek at, say, file position -10? 0x00? 0xFF? EOF? ... there's a reason why fseek() cannot work with that.<br>
<br>On top of the API change problems, you'd also add dangerous portability problems if SEEK_* constants are defined differently for the lib and the program using it.<br></blockquote><div><br></div><div>I can't&nbsp;agree&nbsp;with&nbsp;you&nbsp;about the reason why&nbsp;fseek() cannot work with negative indices.<br></div><div><br></div><div>The max length of a file equals max value of uint64, unsigned int.</div><div><br></div><div>fseek() use uint64 means you can go to any position you want from the start of file.</div><div><br></div><div>The sign bit is not&nbsp;exist&nbsp;in&nbsp;uint64.</div><div><br></div><div>So if you pass a&nbsp;negative number to the function, you will get a overflow.</div><div><br></div><div>And&nbsp;the&nbsp;result&nbsp;of&nbsp;compute will be always a positive number, no matter&nbsp;overflowed&nbsp;or&nbsp;not.</div><div><br></div><div>The "fromwhere"&nbsp;will be always SEEK_CUR in fact.</div><div><br></div><div><br></div><div>Maybe I don't&nbsp;understand&nbsp;yours actually&nbsp;means, but in my&nbsp;opinion, pos can not be a&nbsp; negative number, so I can't seek data by SEEK_SET.</div><div><br></div><div><br></div><div id="M2Signature"><div>-- </div><div>使用Opera的电子邮件客户端:<a href="http://www.opera.com/mail/">http://www.opera.com/mail/</a></div></div></body></html>