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

Re: Off_t vs. off_t vs. int

Thread Previous | Thread Next
From:
Enache Adrian
Date:
November 12, 2003 18:38
Subject:
Re: Off_t vs. off_t vs. int
Message ID:
20031113025912.GD1188@ratsnest.hole
On Wed, Nov 12, 2003 a.d., Nicholas Clark wrote:
> 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)

No. perldoc -f sysread. The offset could be negative. Look also at
pp_sys.c:1652. Maybe it should be a SSize_t instead of an int.

As of using Off_t, Off_t can be 64 bit on a 32 bit machine. The offset
in pp_sysread is a an offset into memory. Would you like to address more
than the addressable memory ?

> 
> > 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?

They're just fine. sizeof([IU]V) >= sizeof(void*). Please give me
an example where sizeof(size_t) > sizeof(void*).

Regards,
Adi

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