Re: Dodgy function pointer casts

Ben Hutchings <ben-/[email protected]>
Newsgroups gmane.comp.window-managers.ion.general
Message-ID <[email protected]>
0On Thu, 2007-04-26 at 07:12 +0000, Tuomo Valkonen wrote:
> On 2007-04-25, Ben Hutchings <ben-/[email protected]> wrote:
> > Is this change likely to be acceptable, Tuomo?
> 
> Umm... any kind of OO shit in C absolutely positively depends on
> function pointer casts.

I haven't noticed this being necessary in the GObject system.  It does
rely on data pointer casts, but those are fine.

> Or are you going to wrap all the _hundreds_
> of pseudo-dynamic functions? Over my dead body.
> 
> More uglier is the case of function pointers to data pointers used
> somewhere in the code. I haven't checked if there's a way around it,
> but then again, any sane architechture will have matching function 
> and data pointers. (Functions should be nothing special! They should
> be data like everything else! Stuff of the first class!)

While these casts aren't allowed in standard C, casting between void *
and function pointer types must work on any system which has dlopen().

Ben.

-- 
Ben Hutchings
If God had intended Man to program,
we'd have been born with serial I/O ports.
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBGMTvT79ZNCRIGYgcRAu2VAJ9ZTMacBqK0VJ3nbc/bIRbuRRrMngCdFGBB
RyRIIdgSP4ugemKMkFhIHB4=
=wO8p
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.