[Issue 2364] New: ftell return type is long in C, that is 64-bit on x86-64

Steven Schveighoffer schveiguy at yahoo.com
Thu Sep 18 09:24:49 PDT 2008


"Denis Koroskin" wrote
> On Thu, 18 Sep 2008 08:52:13 +0400, Sean Kelly <sean at invisibleduck.org> 
> wrote:
>
>> downs wrote:
>>> d-bugmail at 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 at digitalmars.com
>>>>         ReportedBy: terranium at yandex.ru
>>>>
>>>>
>>>> But in D it's declared as int ftell(FILE *);
>>>>
>>>>
>>>  So .. ptrdiff_t?
>>
>> Nope, C long.  So 32 bits on Win32, Win64, and 32-bit *nix, but 64 bits 
>> on 64-bit *nix.
>
> 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).

Better answer: don't use ftell :)

But in case you have to, it seems that a version'd c_long is in order.

-Steve 




More information about the Digitalmars-d-bugs mailing list