Opened 12 years ago

Closed 12 years ago

#666 closed defect (fixed)

Compiler error in 32-bit build

Reported by: bhaskar Owned by: davidf
Priority: major Milestone: HM-8.1
Component: HM Version: HM-7.2
Keywords: Cc: fbossen, ksuehring, davidf, jct-vc@…

Description

Compiler error on a 32-bit build (present since HM-7.2):
.../source/Lib/TLibCommon/TComTrQuant.cpp:2225: error: integer constant is too large for "long" type

Root cause:
Missing 64-bit size qualifier in constant at .../source/Lib/TLibCommon/CommonDef.h:115
(integer constants are 32-bit unless forced otherwise)

Offending code:
#define MAX_INT64 0x7FFFFFFFFFFFFFFF /< max. value of signed 64-bit integer

Corrected code:
#define MAX_INT64 0x7FFFFFFFFFFFFFFFLL /< max. value of signed 64-bit integer

Change:
Addition of 'LL' (long long) suffix to constant

Change History (5)

comment:1 Changed 12 years ago by DefaultCC Plugin

  • Cc fbossen ksuehring davidf jct-vc@… added

comment:2 Changed 12 years ago by ksuehring

I was wondering why we are not using the C standard limits INT_MAX, UINT_MAX, etc.

But it seems on Linux INT64_MAX is only defined for C, not C++ (at least in stdint.h) and on Windows we have _INT64_MAX.

The C++ way of doing this would probably be the following:

#include <limits>

#define MAX_UINT                    numeric_limits<UInt>::max()
#define MAX_INT                     numeric_limits<Int>::max()
#define MAX_INT64                   numeric_limits<Int64>::max()
#define MAX_DOUBLE                  numeric_limits<Double>::max()

Shall we correct it that way?

comment:3 Changed 12 years ago by ksuehring

  • Milestone set to HM-8.1

comment:4 Changed 12 years ago by ksuehring

  • Owner set to davidf
  • Status changed from new to assigned
  • Version changed from HM-7.1 to HM-7.2

comment:5 Changed 12 years ago by ksuehring

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed following the original suggestion in the ticket in r2747. We should actually remove all own MAX* defines and use the ones from the system, but at the moment just make it compile again.

Note: See TracTickets for help on using tickets.

This list contains all users that will be notified about changes made to this ticket.

These roles will be notified: Reporter, Owner, Subscriber, Participant

  • Bhaskar Karmakar(Reporter)
  • David Flynn(Owner, Subscriber)
  • Frank Bossen(Subscriber)
  • jct-vc@…(Subscriber)
  • karl.sharman@…(Always)
  • Karsten Suehring(Subscriber, Participant, Always)