Strange Casting Problem


Subject: Strange Casting Problem
From: Sam TH (sam@uchicago.edu)
Date: Tue Feb 06 2001 - 05:05:44 CST


As part of my fun autoconfiscation of the AbiWord tree (It Links, It
Runs) I came across some very strange errors involving casting from a
void * to an enum. The compiler didn't like the casts, basically, and
wouldn't accept them. They look like this:

fp_PageSize::Type foobar = (fp_PageSize::Type) gtk_function_here(with,
arguments)

This won't compile.

Changing it to this fixes it.
fp_PageSize::Type foobar = (fp_PageSize::Type) (unsigned int)
                        gtk_function_here(with, arguments)

However, the degree to which this is ugly and disgusting boggles the
mind.

So, two questions here:

1) Why am I getting these errors on the autoconfiscated build, and not
on normal builds? I have none of the fun warning and ansi options
set.

2) Why are functions that should be giving us an enum, or something
vaguely like it, giving us a void *?

The patch to make all the errors go away is attached. But I *really*
don't like it.

Ideas?

        sam th
        sam@uchicago.edu
        http://www.abisource.com/~sam/
        GnuPG Key:
        http://www.abisource.com/~sam/key




This archive was generated by hypermail 2b25 : Tue Feb 06 2001 - 05:05:02 CST