Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-06-17 05:17:57


Daryle Walker wrote:

>> do
>> {
>> ifs.read( buffer, buffer_size );
>> len = ifs.gcount();
>> result.process_bytes( buffer, len );
>> } while ( ifs && (buffer_size == len) );
>>
>> and I think that check for "buffer_size == len" is not needed. If
>> 'read' fails to read 'buffer_size' bytes, it must set both eofbit and
>> failbit, so "ifs" will evaluate to false. Is there any particular
>> reason you have the check here --- maybe some library is buggy?
>
> No, I was trying to be double-sure that the loop ended. I've removed
> the extra "buffer_size == len" test (and optimized the resulting loop).

Great.

>> Also, as long as the program accepts several files as arguments, it's
>> probably better to output CRC for each file, not for all of them.
>
> If you want separate CRCs, then run the program multiple times. If we
> switch to the way you want it, then the only way to get a combined CRC
> would to join everything to a giant file first. I probably won't
> change it; the program is meant only as an example, not for industrial
> use.

No problem.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk