jacob navia <
ja...@jacob.remcomp.fr> writes:
>The lcc-win compiler uses long long for fseek/ftell and thus supports
>files bigger than 2Gig... commonplace nowadays.
Clearly not standard compliant as the standard defines is as:
int fseek(FILE *stream, long int offset, int whence);
The posix standard adds the following function (and similar):
int fseeko(FILE *stream, off_t offset, int whence);
off_t is the type which big enough for all file positions;
on 32 bit systems it can 32 but also 64 (might depend on the
compilation environment) Many 32-bit posix systems have added
a "large file compilation environment" in the 90's.
>Could it be possible to change the prototype of those functions in the
>standard?
No, generally it is not possible to change the prototype to use
incompatible types.
As this problem already existed 20 years ago and was fixed in that time
without modifying the prototype, I guess I am not alone in that opinion.
>This would be a compatible change since any int can be extended to long
>long and working code would not change...
Actually, it wouldn't. You are forgetting binaries compiled with
the old headers.
>The situation now is impossible with POSIX adding fseeko and ftello and
>other vendors using various other names (fseek64 and ftell64 being also
>used)
Which particular systems do you have where this is an issue?
Most 64-bit systems use a 64 bit long and they do not have this
issue; even phones now have > 4GB of memory and disks and now
are getting 64 bit CPUs.
>Updating those functions would be the easiest way out.
Clearly not because it break compatibility. And what type would
you use? What type does the standard have which is at least 64 bits?
Casper