develooper Front page | perl.perl5.porters | Postings from November 2003

Re: Off_t vs. off_t vs. int

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
November 12, 2003 14:51
Subject:
Re: Off_t vs. off_t vs. int
Message ID:
20031112225130.GN6287@plum.flirble.org
On Wed, Nov 05, 2003 at 05:57:38PM -0800, Stas Bekman wrote:
> Perl_pp_sysread uses int for its offset argument. PerlIO uses Off_t for 
> offsets. Should Perl_pp_sysread use Off_t as well? isn't int too small for 
> reading with large file supporting systems?

PP(pp_sysread)
{
    dSP; dMARK; dORIGMARK; dTARGET;
    int offset;


Mmm. yes, I suspect that it should based on a cursory glance.
Or at least the correct STRLEN type (as it's the offset into the scalar)

> Off_t is alised to off_t, but off_t is not in the typemap. should it be in 
> the typemap and be mapped to T_NV?
> 
> Also the typemap defines:
> 
> size_t                  T_UV
> ssize_t                 T_IV
> 
> again aren't they too small for large filesystems?

Probably. Unless you compile perl with 64 bit ints.

>                                                    and should be T_NV?

Converting anything file size related from an integer to floating point
gives me the willies. Mainly because floating point will silently
lose precision once your files get larger than (say) 2**53
Seeking 1 byte wrong isn't that big a deal, is it?

I'm not sure that there is a good answer to any of this.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About