[Issue 1469] "alias int fpos_t" in std.c.stdio is wrong on Darwin

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 4 11:13:13 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1469





------- Comment #3 from u.singer at gmx.net  2007-09-04 13:13 -------
(In reply to comment #2)
> Darwin uses "long" for fpos_t in C too, on 32-bit Mac OS X at least.
> [...]
> 

Well it did - "did" from my point of view :-) . Here are the relevant lines
from my headers (gcc 4.0.1):

/usr/include/stdio.h:
#if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)
typedef __darwin_off_t          fpos_t;
#else
typedef __int64_t               fpos_t;
#endif

/usr/include/sys/_types.h:
typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */

Admittedly, my current CPU is a PowerPC G5 (ppc970), which is a 64-bit
processor. The OS version is Mac OS X 10.4.10 (Darwin 8.10.0), but the 64-bit
definition was there  from 10.4.0 (Darwin 8.0.0) on. Opposed to this, size_t &
sizeof(void*) are (normally) still 32-bit and standard OS ABIs depend on that.
I have no idea yet what this looks like on the current Intel-CPU Macs...

I saw that there already are CPU-specific tests like "version (BigEndian)" &
"version (LittleEndian)". Maybe a similar OS-independent thing to test
64-bittedness, combined with the OS, would address the problem better than a
pure OS dependency.


-- 



More information about the D.gnu mailing list