Subject: Re: qsort problems
To: Berndt Josef Wulf <wulf@ping.net.au>
From: David Brownlee <david@mono.org>
List: netbsd-help
Date: 11/08/1996 00:04:30
	I don't think this is your problem, but to be pedantic :), you
	should have const in the variable definitions...
	
int comparison( const TTY_NODE **arg1, const TTY_NODE **arg2 )


		David/abs	david@{mono.org,southern.com,mhm-internet.com}

System Manager: Southern Studios Ltd, PO Box 59, London N22 1AR.
Satisfied User: NetBSD, free Un*x {i386,sparc,mac68k,+more} 'www.netbsd.org'.
  System Admin: MHM Internet, 14 Barley Mow Passage, Chiswick, London W4 4PH.
         SysOP: Monochrome, Largest UK Internet BBS - 'telnet mono.org'.

On Thu, 7 Nov 1996, Berndt Josef Wulf wrote:

> G'day all,
> 
> I have problems with qsort as long as I can think of when trying to
> built packages which utilize this function. On building the package I
> get the following warning message:
> 
> cc -O -Wall -pedantic -g   -c utmp.c
> utmp.c: In function `Set_Time_To_Act':
> utmp.c:229: warning: passing arg 4 of `qsort' from incompatible
> pointer type
> 
> This line looks like this:
> 
> qsort( (void *)l_array, (size_t)count, sizeof(TTY_NODE *), comparison);
> 
> Argument 4 in this function is defined as followed:
> 
> int comparison( TTY_NODE **arg1, TTY_NODE **arg2 )
> 
> I have tried almost everthing but can't get it to compile without the
> warning message. This is not the only package giving me this trouble,
> e.g. msql displays similar problems.
> 
> NetBSD and FreeBSD give following definition for qsort in the man-ages:
> 
> void
> qsort(void *base, size_t nmemb, size_t size,
> int (*compar)(const void *, const void *))
> 
> I am sure that this has been worked out previously but fail to find
> the answer myself...
> 
> Can someone explain what needs to be done in view to get a clean
> compile? 
> 
> cheerio Berndt
> -- 
> Name	: Berndt Josef Wulf
> E-Mail	: wulf@ping.net.au
> Sysinfo	: DEC AXPpci33+, NetBSD-1.2
>