cast warnings
Gene C.
czar at czarc.net
Wed Jan 28 22:05:31 UTC 2004
On Wednesday 28 January 2004 15:34, Michal Jaegermann wrote:
> On Wed, Jan 28, 2004 at 12:57:41PM -0500, Gene C. wrote:
> > I went to some effort to clean up nessus so building it had no cast
> > messages. But was it worth it.
>
> Here you are. :-)
My effort were to get rid of the cast messages and not to really fix the code
(see below). I did check the underlying code of the called function and it
is going to work. Nessus keeps a lot of its data in tables where an element
"value" may contain a pointer or an integer having various meanings depending
on the setting of another int variable in the element. The storage for the
"value" is defined as "void *" so the right size will be allocated.
>
> > For example, you have a function which extracts
> > something from an array/table and may return a pointer sometimes and
> > other times an integer.
>
> Then really union should have been used; but sources of X, for
> example, are chock-full of such junk and that's life.
Yes, sigh, you are right. Doing things the right way would involve using a
union.
If I was the owner of a package, I might (almost assuredly would) do it the
right way. But, for many upstream package owners/originators/maintainers,
they are more interested in package functionality than in doing things "the
right way" so that the "right thing" is done regardless of the
architecture/platform and moving to a system with 128 bit address still
works.
If a package owner decides to do things "the right way", then it will likely
get down. For someone downstream to submit (likely extensive) patches is a
whole different situation. I will need to think about whether it is worth
the attempt.
Thanks for your comment ... it clarified things for me. The use of unions had
occurred to me but I rejected it as too intrusive into the package owners
efforts.
--
Gene
More information about the fedora-test-list
mailing list