64-Bit Operator Overloading Adventure
Jonathan Wakely
jwakely.gcc@gmail.com
Mon Jan 14 03:20:00 GMT 2008
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
More information about the Gcc-help
mailing list