This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 64-Bit Operator Overloading Adventure


On 11/01/2008, Brian D. McGrew <brian@visionpro.com> wrote:
> Good morning,

Hi,
I've only replied to gcc-help as this is not related to development of GCC.

> I've got a codebase that's a hundred years old, started in life on Sun3
> and have evolved to 32-Bit X86 Linux (Fedora 5).  We're trying to move
> to 64-Bit now and this same code that has compiled for years is barking
> about operators cannot be overloaded.

Without more detail it's hard to know, but it sounds like you might
have overloads using typedefs where the underlying type has changed.

e.g.

#ifdef  IN_32_BIT_MODE
typedef long foo_t;
#else
typedef int foo_t;
#endif

struct S
{
    S operator+(int);
    S operator+(foo_t);
};

This will only compile if IN_32_BIT_MODE is defined.

Alternatively, the changes you've made to change longs to ints could
cause a problem in code like this:

typedef int bar_t;

struct S
{
    S operator+(long);   // change to int
    S operator+(bar_t);
};



Jon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]