strcmp

John Kewley ICL jk at cs.man.ac.uk
Sat Jun 15 01:07:08 AEST 1991


Are there any  examples of source code for strcmp, I need to implement code for
a large variety of types in the style of strcmp and
would like to see what has been done before.

I know this seems like a simple school exercise, but I would like to see various
implementations.

e.g.

	intcmp : 
		((a>b)+(a>=b))-1
	or
		(a>=b>?(a>b):-1

	How much quicker is the second one likely to be? It also seems "nicer"
as well, adding two boolean values is not very "nice".

--
        J.K.
 
John M. Kewley, ICL, Wenlock Way, West Gorton, Manchester. M12 5DR
Tel:   (+44) 61 223 1301 X2138  Email: jk at cs.man.ac.uk / jk at nw.stl.stc.co.uk



More information about the Comp.lang.c mailing list