https://issues.dlang.org/show_bug.cgi?id=18017
Steven Schveighoffer <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Hardware|x86_64 |x86 Summary|File.size() uses a 32-bit |[External] [DMC] |signed integer for size |File.size() uses a 32-bit |internally (gives wrong |signed integer for size |results for files over ≈2.1 |internally (gives wrong |GB) |results for files over ≈2.1 | |GB) --- Comment #1 from Steven Schveighoffer <[email protected]> --- The issue here is that DMC's 32-bit ftell returns a 32-bit signed value, and this translates to int.min here. Then phobos translates that to an unsigned long (64-bit). The workaround is to simply use 64-bit C runtime (dmd -m64), which should work properly. But until DMC's clib can support 64-bit ftell, D can't do anything about this. Sure we can treat values from int.min to -2 as unsigned, but that doesn't help with 5GB files for instance. One thing we *could* do is throw an error. But I'm not sure that's a "solution". Nor am I sure that this workaround would work for files that are larger than uint.max. --
