64 bit coding

bill davidsen davidsen at tmr.com
Wed Apr 25 19:37:45 UTC 2001

In article <20010423115547.A8145 at gblx.net>, Dan Foster  <dsf at gblx.net> wrote:

| 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:
| "conffile.c", line 60.19: 1506-743 (I) 64-bit portability: possible change of
| result through conversion of int type into long type.
| "conffile.c", line 60.26: 1506-742 (I) 64-bit portability: possible loss of
| digits through conversion of long type into int type.
| Compiler is VisualAge C/C++ 5.0 under AIX 4.3.3 with the -q64 and -qwarn64
| compiler options enabled in Makefile.global.

  Looks like the compiler is giving you warnings worth less than free
legal opinions in alt.flame... there are no long or ints involved,
right? No scalar type to be converted to/from, no conversion issues at
all. These are two pointers of identical (char *) type, and assigning
between them involves, or should involve, nothing beyond whatever is
wearing the bit-for-bit-copy hat this week, such as LDA/STA or some

  Of course I can't find that code in the source either, so I'm totally
bamboozled. Or flummoxed, someone else was recently flummoxed, why not
I? At any rate, I can't find that code, and I read it as dead correct,
so I would worry about the compiler, not the code.

| Why am I interested in seeing INN be 64 bit clean? Because with the way
| newsfeeds are growing, means that eventually we'll see very large databases,
| CNFS files, memory space, etc.
| I'm not too experienced with the portability issues for 32->64 bit coding,
| especially since this may differ on a per-platform level. Suggestions welcome.
| Only thing I can think of is some kind of conditional platform specific
| typedef'ing and use that, as ugly as that sounds.

  A poor idea, where warning occur you should either use a cast to chut
them up, or fix the problem if there really is one. I can live with the
idea of article size never being larger than an int (I hear users scream
already), so whining about things like that is futile.

| 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 *).

  And well it deserves to be broken, as well as code which assumes that
int means 32 bits. Not portably it doesn't.

bill davidsen <davidsen at tmr.com>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.

More information about the inn-workers mailing list