Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!bywater!arnor!arnor!marc From: marc@arnor.UUCP (Marc Auslander) Newsgroups: comp.lang.c Subject: Re: Efficient STRing CoMPares? Message-ID: Date: 20 Mar 91 13:02:39 GMT References: <1991Mar15.142821@mars.mpr.ca> <15486@smoke.brl.mil> <1193@caslon.cs.arizona.edu> Sender: news@arnor.uucp (NNTP News Poster) Organization: IBM T.J. Watson Research Center, Hawthorne, New York Lines: 21 In-Reply-To: peter@ficc.ferranti.com's message of 19 Mar 91 00:43:12 GMT A correct compiler cannot inline strcmp unless it is given extralingual permission to do so - for example in a pragma or by defining some reserved symbol or by some other means. This is because it is legal to combine a program which uses strcmp with another which defines it to by anything at all! For example, the Risc System/6000 xlc compiler inlines __strcmp and __strcpy. (In Ansi C, its ok for the compiler to do funny things with symbols which start with "__"). Then, string.h contains defines of strcmp and strcpy to the __ versions which are done if __STR__ is defined. From the user point of view, you define __STR__ if you want in line string functions. On user approach is to add -D__STR__ to the CFLAGS in his make file. (If you're going to the trouble of inlining, its a good idea to do it in a way which lets you get the advantage in benchmarks!) -- Marc Auslander