Mail Archives: djgpp/1996/04/12/01:38:14
[snip]
>Is there any reason why you can't do something similar with your
>function, either having a 'shell' function convert each of the
>arguments and return values to the proper type, or having your
>function do this itself? All qsort() wants is a negative or zero
>number if the elements don't get swapped, and a positive number if
>they do. Much easier than trying to do a typecast on the function
>itself.
John: Actually, the easier solution is the cast. The proj
I'm working on is a legacy app (mentioned in my orig post) and the old
fn is similar to qsort() in that it specs that one of its formal args
is a ptr to a fn. But rather than code a three/four line wrapper every
time I needed to use a different fn type (w/ an unsigned arg instead
of an int) I wanted to use a cast that would be shorter to write. Of
course, responding to the e-mail traffic from my question has negated that
savings. :-) You're right, though, and I *did* think about usg a
wrapper at first, then decided this was a moment to pose a question
to the folks on the 'net and learn an obscure bit of C notation that's
eluded me in the past.
This exercise has been educational beyond discovering how to
code that simple little cast.... Jet
=======================================================================
The continued survival of the human race, despite its own stupidity,
is the strongest argument for the existence of a benevolent God.
=======================================================================
- Raw text -