[ircd-ratbox] [PATCH] ratbox-services CVS 20050517: gcc 4.1 20050515

Jilles Tjoelker jilles at stack.nl
Tue May 17 13:47:11 EDT 2005


On Tue, May 17, 2005 at 06:59:48PM +0200, Ralf S. Engelschall wrote:
> The following patch against Ratbox-Services CVS snapshot as of 20050517
> fixes a type conflict on an assignment, an initialization warning
> (although the code is correct) and removes two nasty conflicts of "void"
> pointer vs. function pointer assignment (which is not allowed under
> strict ISO-C) by using the usual intermediate "union". This allows
> Ratbox-Services to pass GCC 4.1.0 20050515 even under -Wall -pedantic.

The intermediate "union" (union { hook_func fp; void *vp; } u;) is a
very bad thing. This means that the code will compile when function
pointers cannot be assigned to void * and crash at run-time instead of
failing at compile time. Example: MS-DOS "medium memory model" with
16+16 bit function pointers and 16 bit data pointers. I don't think it
is important to support architectures like these, but they should not
fail in nastier ways than they already did. In addition, the current
code is nicer to read than the patched one.

-- 
Jilles Tjoelker


More information about the ircd-ratbox mailing list