On Sun, 28 Oct 2007, Dan Hipschman wrote:
The logic is as follows:
Thanks for the explanation, Dan!
Better than this would be to put "assert(is_user_type(type));" above the initializations to convince the programmer at least that name will get initialized correctly in get_user_type. If that doesn't convince the compiler then I don't think it's worth it to try to placate it since we're supposed to be wrting code for humans, not computers.
I think the question is whether a compiler can reasonably be expected to deduce that the source is fine. If that deduction involves solving the halting problem (or similar) hacking the source to avoid the warning actually doesn't occur to be that bad. ;-)
After the work I did again in the last weeks Wine now builds more or less without warnings for most versions of GCC (and our default set of options). If things continue to proceed well, this may be the only warning left in the whole codebase in a week or two.
I think the real problem is that the code is just not clear enough. I've been meaning to add asserts. Where asserts are impractical: comments.
Does this mean you are going to submit some patches to address this?
Gerald