digitalmars.D.learn - File.size() is a ulong
- bearophile (8/8) Jan 09 2011 From a recent update in File I've seen that size() returns an ulong, giv...
- spir (11/19) Jan 09 2011 n by seek():
- Jonathan M Davis (6/18) Jan 09 2011 Well, create a bug report then. fseek() does appear to take a long, so i...
From a recent update in File I've seen that size() returns an ulong, given by seek(): http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?rev=2284#L585 http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?rev=2284#L1245 It uses fseek, that seems to return a signed value: http://www.cplusplus.com/reference/clibrary/cstdio/ftell/ Isn't it better and safer if those functions of File return a long instead of an ulong? Bye, bearophile
Jan 09 2011
On Sun, 09 Jan 2011 08:29:47 -0500 bearophile <bearophileHUGS lycos.com> wrote:From a recent update in File I've seen that size() returns an ulong, give=n by seek():http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?r=ev=3D2284#L585http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?r=ev=3D2284#L1245=20 It uses fseek, that seems to return a signed value: http://www.cplusplus.com/reference/clibrary/cstdio/ftell/ =20 Isn't it better and safer if those functions of File return a long instea=d of an ulong? For any reason, I would rather expect sizediff_t (read: a cardinal). Denis -- -- -- -- -- -- -- vit esse estrany =E2=98=A3 spir.wikidot.com
Jan 09 2011
On Sunday 09 January 2011 05:29:47 bearophile wrote:From a recent update in File I've seen that size() returns an ulong, given by seek(): http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?re v=2284#L585 http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/stdio.d?re v=2284#L1245 It uses fseek, that seems to return a signed value: http://www.cplusplus.com/reference/clibrary/cstdio/ftell/ Isn't it better and safer if those functions of File return a long instead of an ulong?Well, create a bug report then. fseek() does appear to take a long, so it probably would make more sense for File's size() function to use long as well. However, given that it makes no sense for a file's size to be negative, I'm not sure that it really matters. - Jonathan M Davis
Jan 09 2011