64 bit coding
dsf at gblx.net
Wed Apr 25 00:46:10 UTC 2001
Hot Diggety! Russ Allbery was rumored to have written:
> I think that if a compiler is warning about this sort of thing, there's
> something wrong with the compiler. What is it complaining about, that
> you're assigning a smaller data type to a larger data type? That's
Point. Maybe complaining in case someone isn't thinking of portability and
using some special tricks or explicit hardcoded assumptions, from the
perspective of the compiler team members who wishes to warn 'just in case',
> > Then there are assumptions that char will always be an int, such as:
> > char *result, *p;
> > p = result;
> > results in this complaint from the compiler:
> Huh? What does an int have to do with anything? That's assigning a char
> pointer to a char pointer.
On a closer look, not quite sure either. Since pointer size was one of the
things that changes with -q64 enabled, the compiler might be flagging any
references to both 'char' and '*' to warn, I'd imagine?
(perhaps in the off chance someone uses direct pointer arithmetic to
access specific memory locations, not taking into account size changes.)
> > With AIX's compiler in 64 bit mode, it converts all long and pointers to
> > be 64 bit wide. This breaks any code that assumes sizeof(int) ==
> > sizeof(long) == sizeof(void *).
> INN shouldn't be making any assumptions like that.
I didn't say INN was breaking this; merely noting the changes in the
compiler behavior for when -q64 is enabled.
> I actually doubt that INN *is* making many assumptions like that, as INN
> has worked fine on Tru64 for quite some time. I think you've got an
> overactive compiler that's jumping at shadows, from the examples you've
> given so far. But I'd be happy to see more specific details....
We'll soon find out how well it works in practice. :) I'm still not fully
convinced that I'm smarter than the compiler team by ignoring the warnings.
After all, there's been a general push over time to make INN build cleanly
I'll take a closer look at the warnings later, and also report back after
I've had a chance to try out more actual tests using a 64 bit enabled innd.
More information about the inn-workers