[vorbis-dev] vorbisfile updates, and a couple of questions
Jonathan Blow
jon at bolt-action.com
Fri Apr 21 05:15:45 PDT 2000
> Casting function pointers appears
> to be a rather arcane sort of thing to do. Anyone with more C clues than I
> care to speak up?
The syntax for that has got to be hairy... what I would do is make typedefs
for both types, and then cast one to the other. So...
typedef void (*stdio_func)(FILE *file1, FILE *file2);
typedef void (*voidp_func)(void *pointer1, void *pointer2);
voidp_func uncasted = /* get this however you get it */;
stdio_func casted = (stdio_func)uncasted;
casted((FILE *)argument1, (FILE *)argument2);
I may have gotten that slightly wrong, but hey. Now if the compiler doesn't
let you do that, you'll have to do something more nasty but I think that
should work.
-J.
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
More information about the Vorbis-dev
mailing list