digitalmars.D.bugs - opApply bug?
- Regan Heath (56/56) Mar 27 2005 Calling writefln from within an opApply does strange things..
- Ben Hinkle (5/12) Mar 28 2005 There should be a check for writeable in Stream.writefln and friends tha...
- Regan Heath (7/23) Mar 28 2005 *smacks head* of course! Thanks. So, the write is advancing the read
Calling writefln from within an opApply does strange things.. Compile: dmd test30.d -g -debug -unittest Output: READ[1] READ[Line 2] READ[Line 3] READ[Line 4] Regan
Mar 27 2005
Compile: dmd test30.d -g -debug -unittest Output: READ[1] READ[Line 2] READ[Line 3] READ[Line 4]There should be a check for writeable in Stream.writefln and friends that isn't there. What is happening is that the writefln in the opApply is calling the stream's writefln, not std.stdio.writefln. Since the stream is opened in read-only mode writing should be illegal. It will work if you say std.stdio.writefln or if you don't import std.stdio and put stdout.writefln.
Mar 28 2005
On Mon, 28 Mar 2005 08:12:47 -0500, Ben Hinkle <ben.hinkle gmail.com> wrote:*smacks head* of course! Thanks. So, the write is advancing the read pointer? Is it better to make the read/write pointers independant of each other, or not. IIRC C's FILE api has 1 pointer. What do other implementations use? ReganCompile: dmd test30.d -g -debug -unittest Output: READ[1] READ[Line 2] READ[Line 3] READ[Line 4]There should be a check for writeable in Stream.writefln and friends that isn't there. What is happening is that the writefln in the opApply is calling the stream's writefln, not std.stdio.writefln. Since the stream is opened in read-only mode writing should be illegal. It will work if you say std.stdio.writefln or if you don't import std.stdio and put stdout.writefln.
Mar 28 2005