According to Bill Currie:
On 31 Jul 97 at 15:08, Jukka Virtanen wrote:
I suggest that this problem is fixed by casting the result of the pointer subtraction to (unsigned ptrdiff_t) which is always large enough, something like:
One slight problem: I couldn't find a `ptrdiff_t' in djgpp. However, it could always be created.
Not a slight, but a big problem: (i) See `../cccp.c', line 51; (ii) `ptrdiff_t', even if it exists, is a signed type, and GCC doesn't accept `unsigned ptrdiff_t'. :-(
To work around, what about the following? It only must produce a more-or-less unique number ...
/* We must avoid negative values. Naturally, we would cast this to * `unsigned ptrdiff_t', but since we cannot be sure that the platform * we compile GPC on will support this, we use `abs' instead. */ #define HASH_FUNC(NODE) ((abs ((NODE) - (tree) 0) >> 2) % MAX_HASH_TABLE)
Greetings,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970714] - http://home.pages.de/~gnu-pascal/ [970125]