tech-kern archive

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

Re: qsort_r



On Sun, Dec 08, 2013 at 06:21:16PM -0500, Mouse wrote:
> > My irritation with not being able to pass a data pointer through
> > qsort() boiled over just now.
> 
> This sort of thing is one reason I do not consider nested function
> support optional in any compiler I consider using: they make it easy to
> curry away function arguments to generate something suitable for
> passing to (say) qsort, thereby fixing the problem once, for all uses,
> rather than depending on each called thing being fixed separately.

Nested functions the way GCC implements them are broken. For once, they
introduce security issues by requiring an executable stack. Anonymous
functions with lexical scope can be done properly, lambdas in C++11 are
an example. They shouldn't be shoe horned into C this way though.

Joerg


Home | Main Index | Thread Index | Old Index