develooper Front page | perl.perl5.porters | Postings from July 2012

Re: [perl #113994] [META] seek and tell operate on bytes

Thread Previous | Thread Next
Tony Cook
July 4, 2012 18:03
Re: [perl #113994] [META] seek and tell operate on bytes
Message ID:
On Wed, Jul 04, 2012 at 04:29:48PM -0500, Jesse Luehrs wrote:
> I don't personally have any ideas, there just seemed to be a lot of
> tickets related to this issue, and it wasn't clear that they should all
> be immediately closed as wontfix. If we end up making that decision,
> this will at least make it easier to clear out the tracker.

I think they should be wontfix.

If I have a character oriented stream that I've sensibly cached
positions for (by calling tell()), I can currently efficiently and
reasonably call seek() to return to that character in the file, even
though I've stored a byte position.

If seek()/tell() is changed to work in characters, with the "seek to
the beginning and count characters" then the code described above will
still work, but will become enourmously inefficient.

As a reference, C only defines fseek() to random positions for binary
streams, on text streams the only specified behaviour is for fseek(f,
0, (any SEEK_*)) and fseek*f, some_value_from_ftell, SEEK_SET).


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About