Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread mdf
On Tue, Feb 19, 2013 at 3:57 PM, Giorgos Keramidas keram...@freebsd.org wrote: Author: keramida (doc committer) Date: Tue Feb 19 23:57:39 2013 New Revision: 247014 URL: http://svnweb.freebsd.org/changeset/base/247014 Log: Add a sample program that shows how a custom comparison function

Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread David Chisnall
On 20 Feb 2013, at 08:25, m...@freebsd.org wrote: These should be declared const int *. And the cast shouldn't be needed in C, since void * can be assigned to any other pointer type. In fact, the entire function body can be replaced with: return (*(int*)p1 - *(int*)p2); qsort doesn't

Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread Giorgos Keramidas
On 2013-02-20 09:32, David Chisnall thera...@freebsd.org wrote: On 20 Feb 2013, at 08:25, m...@freebsd.org wrote: These should be declared const int *. And the cast shouldn't be needed in C, since void * can be assigned to any other pointer type. In fact, the entire function body can be

Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread Stefan Farfeleder
On Wed, Feb 20, 2013 at 09:32:43AM +, David Chisnall wrote: On 20 Feb 2013, at 08:25, m...@freebsd.org wrote: These should be declared const int *. And the cast shouldn't be needed in C, since void * can be assigned to any other pointer type. In fact, the entire function body can be

Re: svn commit: r247014 - head/lib/libc/stdlib

2013-02-20 Thread Giorgos Keramidas
On 2013-02-20 10:49, Stefan Farfeleder stef...@freebsd.org wrote: On Wed, Feb 20, 2013 at 09:32:43AM +, David Chisnall wrote: On 20 Feb 2013, at 08:25, m...@freebsd.org wrote: These should be declared const int *. And the cast shouldn't be needed in C, since void * can be assigned to any

svn commit: r247014 - head/lib/libc/stdlib

2013-02-19 Thread Giorgos Keramidas
Author: keramida (doc committer) Date: Tue Feb 19 23:57:39 2013 New Revision: 247014 URL: http://svnweb.freebsd.org/changeset/base/247014 Log: Add a sample program that shows how a custom comparison function and qsort(3) can work together to sort an array of integers. PR: