tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: qsort_r

On Sun, 08 Dec 2013, Mouse wrote:
Is just casting the function pointers safe in C

No. As soon as you call through a pointer to the wrong type you're off in nasal demon territory. (Loosely put; I'd have to look up the exact wording - there is a little wiggle room, but, if I've understood the subject of the discussion correctly, not enough.)

You can't call through a function pointer of the wrong type, but you can cast from one type to another. I think that's enough, provided that void * is large enough to be converted to and from a function pointer.

If you can find me a description of what NetBSD assumes beyond what C promises, I can have a stab at answering that question.

There is no such list.  That's a bug in NetBSD's documentation.

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index