Modify

Opened 12 years ago

Closed 9 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.

Attachments (0)

Change History (4)

comment:1 Changed 12 years ago by mattiasellert

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

comment:2 Changed 12 years ago by mattiasellert

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 Changed 10 years ago by Daryle Walker

Component: Nonecrc
Severity: Problem

comment:4 Changed 9 years ago by Steven Watanabe

Resolution: Nonefixed
Status: assignedclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Daryle Walker.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.