On Tuesday, June 10, 2003, at 9:24 PM, Daryle Walker wrote: [SNIP]
Note in the "if" statement, I had the construction in it. However, neither one of my compilers took it! Moving the constructor call worked, but I thought my original method should be accepted.
One compiler finished after the above 'fix'. The other (a variant of GCC 3.1) complained about missing symbols at link-time; it could not create the global objects hidden in Boost.CRC. (I haven't worked on the code in a long time; there could be quirks on compilers written after Boost.CRC.)
When I ran the program under the compiler that worked, the "readsome" function always returned zero! There were no suitable substitutes; the "read" function doesn't tell you how many characters it read (bad if the last block isn't full) and the multi-character "get" functions use delimiters. So this program is stuck at single-character reads at the moment. Maybe I should switch to the stream-buffer method you used.
Can you try this out to make sure the problems aren't just mine?
Note to everyone: don't write code when you're half-asleep.
1. The "if" statement problem: object definitions inside the
if-statement's parentheses is OK only for assignment initialization.
if ( Type Object = Expression ) // is allowed
if ( Type Object( Constructor Args ) ) // is banned!
2. Don't know why GCC is having link problems. Help! (BTW, I'm using
an August 2002 eMac with Mac OS X 10.2.6 running Project Builder 2.0.1
with Apple-modified GCC 3.1)
3. While reading a C++ IOStreams book (for the heck of it), I
encountered the "gcount" method. Now the code uses that and the "read"
method.
The updated sample is attached. Would this code be OK to include as an
additional example in the Boost archive?
Daryle
----------
// Boost CRC example program file ------------------------------------------//
// (C) Copyright Daryle Walker 2003. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright notice
// appears in all copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any purpose.
// Revision History
// 12 Jun 2003 Initial version (Daryle Walker)
#include