Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!mucs!jk From: jk@cs.man.ac.uk (John Kewley ICL) Newsgroups: comp.lang.c Subject: strcmp Message-ID: <2695@m1.cs.man.ac.uk> Date: 14 Jun 91 15:07:08 GMT Sender: news@cs.man.ac.uk Reply-To: jk@cs.man.ac.uk (John Kewley ICL) Organization: Department of Computer Science, University of Manchester UK Lines: 22 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@cs.man.ac.uk / jk@nw.stl.stc.co.uk