digitalmars.D.bugs - [Issue 2364] New: ftell return type is long in C, that is 64-bit on x86-64
- d-bugmail puremagic.com (16/16) Sep 17 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2364
- downs (2/22) Sep 17 2008 So .. ptrdiff_t?
- Sean Kelly (3/26) Sep 17 2008 Nope, C long. So 32 bits on Win32, Win64, and 32-bit *nix, but 64 bits
- Denis Koroskin (5/32) Sep 18 2008 Isn't it compiler specific? I.e. DMD declares C long as D int no matter ...
- Steven Schveighoffer (4/37) Sep 18 2008 Better answer: don't use ftell :)
- d-bugmail puremagic.com (5/9) Oct 09 2008 All c types are compiler-specific, but in fact long is 64 bit on x86-64
- d-bugmail puremagic.com (5/5) Oct 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2364
- d-bugmail puremagic.com (4/4) Oct 10 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2364
- d-bugmail puremagic.com (4/4) Oct 10 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2364
- d-bugmail puremagic.com (9/9) Oct 19 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2364
- d-bugmail puremagic.com (11/11) Oct 19 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2364
- d-bugmail puremagic.com (13/13) Oct 19 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2364
- d-bugmail puremagic.com (20/20) Oct 20 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2364
http://d.puremagic.com/issues/show_bug.cgi?id=2364
Summary: ftell return type is long in C, that is 64-bit on x86-64
Product: D
Version: 2.019
Platform: PC
URL: http://digitalmars.com/d/2.0/phobos/std_c_stdio.html#fte
ll
OS/Version: Windows
Status: NEW
Severity: trivial
Priority: P2
Component: Phobos
AssignedTo: bugzilla digitalmars.com
ReportedBy: terranium yandex.ru
But in D it's declared as int ftell(FILE *);
--
Sep 17 2008
d-bugmail puremagic.com wrote:
http://d.puremagic.com/issues/show_bug.cgi?id=2364
Summary: ftell return type is long in C, that is 64-bit on x86-64
Product: D
Version: 2.019
Platform: PC
URL: http://digitalmars.com/d/2.0/phobos/std_c_stdio.html#fte
ll
OS/Version: Windows
Status: NEW
Severity: trivial
Priority: P2
Component: Phobos
AssignedTo: bugzilla digitalmars.com
ReportedBy: terranium yandex.ru
But in D it's declared as int ftell(FILE *);
So .. ptrdiff_t?
Sep 17 2008
downs wrote:d-bugmail puremagic.com wrote:Nope, C long. So 32 bits on Win32, Win64, and 32-bit *nix, but 64 bits on 64-bit *nix.http://d.puremagic.com/issues/show_bug.cgi?id=2364 Summary: ftell return type is long in C, that is 64-bit on x86-64 Product: D Version: 2.019 Platform: PC URL: http://digitalmars.com/d/2.0/phobos/std_c_stdio.html#fte ll OS/Version: Windows Status: NEW Severity: trivial Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: terranium yandex.ru But in D it's declared as int ftell(FILE *);So .. ptrdiff_t?
Sep 17 2008
On Thu, 18 Sep 2008 08:52:13 +0400, Sean Kelly <sean invisibleduck.org> wrote:downs wrote:Isn't it compiler specific? I.e. DMD declares C long as D int no matter what. But I agree that it should return long (on 32-bit OS, too).d-bugmail puremagic.com wrote:Nope, C long. So 32 bits on Win32, Win64, and 32-bit *nix, but 64 bits on 64-bit *nix.http://d.puremagic.com/issues/show_bug.cgi?id=2364 Summary: ftell return type is long in C, that is 64-bit on x86-64 Product: D Version: 2.019 Platform: PC URL: http://digitalmars.com/d/2.0/phobos/std_c_stdio.html#fte ll OS/Version: Windows Status: NEW Severity: trivial Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: terranium yandex.ru But in D it's declared as int ftell(FILE *);So .. ptrdiff_t?
Sep 18 2008
"Denis Koroskin" wroteOn Thu, 18 Sep 2008 08:52:13 +0400, Sean Kelly <sean invisibleduck.org> wrote:Better answer: don't use ftell :) But in case you have to, it seems that a version'd c_long is in order. -Stevedowns wrote:Isn't it compiler specific? I.e. DMD declares C long as D int no matter what. But I agree that it should return long (on 32-bit OS, too).d-bugmail puremagic.com wrote:Nope, C long. So 32 bits on Win32, Win64, and 32-bit *nix, but 64 bits on 64-bit *nix.http://d.puremagic.com/issues/show_bug.cgi?id=2364 Summary: ftell return type is long in C, that is 64-bit on x86-64 Product: D Version: 2.019 Platform: PC URL: http://digitalmars.com/d/2.0/phobos/std_c_stdio.html#fte ll OS/Version: Windows Status: NEW Severity: trivial Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: terranium yandex.ru But in D it's declared as int ftell(FILE *);So .. ptrdiff_t?
Sep 18 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2364All c types are compiler-specific, but in fact long is 64 bit on x86-64 architecture (os-independent). --So .. ptrdiff_t?Nope, C long. So 32 bits on Win32, Win64, and 32-bit *nix, but 64 bits on 64-bit *nix.
Oct 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2364 ------- or try MSVC yourself: sizeof(long) == 4. --
Oct 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2364 ... indeed. For some reason I thought different. Was it always like this? --
Oct 10 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2364 ------- Yes, I think it's always been like that. --
Oct 10 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2364
Sobirari Muhomori <dfj1esp02 sneakemail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 19 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2364
Tomas Lindquist Olsen <tomas famolsen.dk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tomas famolsen.dk
03:20:56 PDT ---
Even with the misunderstanding of C long being 32 or 64 bit, translating a C
long to a D int is still wrong.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 19 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2364
Brad Roberts <braddr puremagic.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |braddr puremagic.com
Resolution|INVALID |FIXED
---
Changing to resolved-fixed. In druntime, where this stuff lives now, it's
defined as a c_long:
c_long ftell(FILE* stream);
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 19 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2364
Andrei Alexandrescu <andrei metalanguage.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrei metalanguage.com
12:10:56 PDT ---
I'd like to replace the antiquated fseek/ftell routines with 64-bit routines
straight inside druntime. On Windows, there's _fseeki64:
http://msdn.microsoft.com/en-us/library/75yw9bf3%28VS.80%29.aspx
On Linux, there's fseeko64:
http://www.mkssoftware.com/docs/man3/fseek.3.asp
I couldn't find the appropriate OSX routine, and I wouldn't be able to test it
either. I know Sean is very busy, so may I get a hand from around here?
Ideally what I'd like to do would be to take care of whatever
forwarding/aliasing is needed inside druntime to make the normal fseek and
ftell routines use 64-bit ulong. (Sean approved.) Please let me know if you
could help, thanks!
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 20 2009









"Steven Schveighoffer" <schveiguy yahoo.com> 