bugmonotone - Bugs: bug #20622, Asserts using undeclared CHAR_BIT

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #20622: Asserts using undeclared CHAR_BIT

Submitted by:  None
Submitted on:  Sun 29 Jul 2007 10:08:36 PM UTC  
 
Category: portabilitySeverity: 3 - Normal
Item Group: code cleanupStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed
mtn version --full: 

monotone 0.35 (Basis-Revision: f92dd754bf5c1e6eddc9c462b8d68691cfeb7f8b)
Laufe auf : Darwin 8.10.0 Darwin Kernel Version 8.10.0: Wed May 23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power Macintosh
C++-Compiler : GNU C++ version 4.0.1 (Apple Computer, Inc. build 5367)
C++-Standard-Bibliothek: GNU libstdc++ version 20050421
Boost-Version : 1_34
Änderungen seit der Basis-Revision:
format_version "1"

new_manifest [f95da638a0aa17f7c5979d17a059faf6a46e9670]

old_revision [f92dd754bf5c1e6eddc9c462b8d68691cfeb7f8b]

Generated from data cached in the distribution;
further changes may have been made.

Sun 04 Nov 2007 08:07:22 PM UTC, comment #1:

We are no longer using CHAR_BITS anywhere.

Zack Weinberg <zwol>
Project Member
Sun 29 Jul 2007 10:08:36 PM UTC, original submission:

Hi folks,

monotone-0.35 sources assert CHAR_BIT==8 in two locations without #include <limits.h> or such. This breaks compilation under MacPorts. See the attached patch for precise locations.

I have fixed that in a style consistent with the context: Ordinarily, I would do an #include <limits.h>, but hey, this is C++ , and C++ wants to get rid of preprocessor macros. In fact, #include <limits> and assert(numeric_limits<unsigned char>::digits == 8) would be the C++ way. But after all, the surrounding lines used sizeof() which again is more C than C++ in style, and so I simply tested (unsigned char)-1 == 255. Note that ANSI C guarantees the evaluation to succeed and give the correct result, because unsigned data types are specified to work modulo 2**(precision_in_bits).

Regards,
--
Christian Cornelssen

Anonymous

 

Attached Files
file #13523:  assert_char_bit.patch added by None (908B - application/octet-stream - fixes use of undeclared CHAR_BIT in asserts)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by zwol (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 04 Nov 2007 08:07:22 PM UTCzwolStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sun 29 Jul 2007 10:08:36 PM UTCNoneAttached File-=>Added assert_char_bit.patch, #13523

    Back to the top


    Powered by Savane 3.1-cleanup1