|
Boost Users : |
From: Norbert Riedlin (norbert.riedlin_at_[hidden])
Date: 2008-07-29 03:14:25
Hi all,
I want to use boost CRC, but when I #include <boost/crc.hpp>, I get
the following error:
"error: ISO C++ forbids variable-size array 'table_type'"
in line 468 of crc.hpp.
gcc --version tells me, I'm using the following gcc on my Mac (OSX
10.5):
"i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5484)"
I use boost 1.34.1, but as crc.hpp of version 1.35 does not differ, I
suppose updating the library would not help.
The error is in the following context:
<code>
struct crc_table_t
{
BOOST_STATIC_CONSTANT( std::size_t,
byte_combos = (1ul << CHAR_BIT) );
typedef mask_uint_t<Bits> masking_type;
typedef typename masking_type::fast value_type;
#if defined(__BORLANDC__) && defined(_M_IX86) && (__BORLANDC__ == 0x560)
// for some reason Borland's command line compiler (version
// 0x560)
// chokes over this unless we do the calculation for it:
typedef value_type table_type[ 0x100 ];
#else
typedef value_type table_type[ byte_combos ];//<-- error here
#endif
static void init_table();
static table_type table_;
}; // boost::detail::crc_table_t
</code>
I suppose it has to do with a bug of gcc, that cannot calculate
"byte_combos" at compile time (or at least it acts as if it had to
calculate "byte_combos" at runtime). A fix would be to enhance the
"#if defined..." to the gcc versions with the said bug.
I just realized there was an entry in the bug tracking system at
sourceforge concerning this problem:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1478435&gro
up_id=7586
but I have no permission to view the issue. The entry was made in early
2006. Is there any work on this issue?
TIA
Norbert
P.S.: I also realize I can get around the problem by not using
"-pedantic", but for me this is a valuable switch.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net