stream.getc() doesn't recognize eof

Regan Heath regan at netmail.co.nz
Fri Mar 14 10:10:43 PDT 2008


Brian White wrote:
>>         (result == 0 && memcmp(buffer_in, buffer, size) == 0));
> 
> Eee-Gad, but that's painful!  Performance could easily be so bad that 
> I'd turn off the checks and then they're no use at all.

You can use -release to turn off contracts and asserts, so only 
non-release builds would suffer the penalty.

> I've never known a "read" function to modify bytes beyond the "count" 
> amount returned, but I don't know if it's ever explicitly stated not to 
> do so.

True.  You could perhaps cheat a little and remember just the first byte 
of the output buffer, chances are if the first byte hasn't changed, 
nothing was written to the buffer.

Regan


More information about the Digitalmars-d-learn mailing list