Opened 16 years ago

Closed 13 years ago

#613 closed Bugs (fixed)

boost/crc.hpp uses non-standard conforming syntax

Reported by: mattiasellert Owned by: Daryle Walker
Milestone: Component: crc
Version: None Severity: Problem
Keywords: Cc:

Description

[ellert@ellert ~]$ g++ -pedantic -x c++
/usr/include/boost/crc.hpp
/usr/include/boost/crc.hpp:464: error: ISO C++ forbids
variable-size array `table_type'

[ellert@ellert ~]$ g++ --version
g++ (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

The header file uses a non-constant expression as the
size in an array declaration. This is not valid c++,
and the compiler rejects it when using the -pedantic flag.

Change History (4)

comment:1 by mattiasellert, 16 years ago

Summary: boost/crc.hpp used non-standard conforming syntaxboost/crc.hpp uses non-standard conforming syntax

comment:2 by mattiasellert, 16 years ago

Logged In: YES 
user_id=1009278

The expression used as array size is declared
BOOST_STATIC_CONSTANT, so it should be permissable.

Checking various compiler versions...

gcc 3.4.4, 3.4.5 and 4.0.0 fails.
gcc 4.0.2 works.

If I change the offending line from:

typedef value_type   table_type[ byte_combos ];

to:

typedef value_type   table_type[ 1ul << CHAR_BIT ];

it works on all these 4 versions of the compiler. Since
byte_combos is declared as

BOOST_STATIC_CONSTANT( std::size_t, byte_combos = (1ul <<
CHAR_BIT) );

this should be the same. Looks like a compiler bug.

comment:3 by Daryle Walker, 15 years ago

Component: Nonecrc
Severity: Problem

comment:4 by Steven Watanabe, 13 years ago

Resolution: Nonefixed
Status: assignedclosed

(In [53646]) Workaround gcc problems with -pedantic. Fixes #613

Note: See TracTickets for help on using tickets.