tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Local procedures


From: Peter Lund
Subject: Re: [Tinycc-devel] Local procedures
Date: Thu, 13 Sep 2007 16:37:48 +0200

On Thu, 2007-09-13 at 17:08 +0300, Antti-Juhani Kaijanaho wrote:

> What's wrong is exactly that any extra parameters to the comparison
> function *has* to be in the global environment - you don't get to choose
> this.  This makes any code that uses qsort and bsearch nonreentrant (and
> thus thread-unsafe), not to mention the clunkiness it induces in the
> code.

This is, of course, correct.

But please remember that almost all modern code that uses callbacks and
function pointers use an extra parameter (often of type void *) to avoid
this.  GTK+ and Gnome do this /very/ well and are thus quite friendly to
both C and programming in the large.

I would myself of course prefer that local/nested procedures were a part
of the standard language but that's not how things are :/

(And real closures would be even better.  And a half-way decent type
system.  With inference.  And a pony.  And no Kaczynski twins.)

-Peter





reply via email to

[Prev in Thread] Current Thread [Next in Thread]