Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: soundex algorithm wanted Message-ID: <86900048@haddock> Date: Mon, 8-Sep-86 17:16:00 EDT Article-I.D.: haddock.86900048 Posted: Mon Sep 8 17:16:00 1986 Date-Received: Tue, 9-Sep-86 00:31:27 EDT References: <3266@umcp-cs.UUCP> Lines: 26 Nf-ID: #R:umcp-cs.UUCP:3266:haddock:86900048:000:1315 Nf-From: haddock!karl Sep 8 17:16:00 1986 umcp-cs!chris (Chris Torek) writes: >In article <1239@whuxl.UUCP> mike@whuxl.UUCP (BALDWIN) writes: >> register char c, lc, prev = '0'; >All the compilers I have used ignore the `register' on `register char' >declarations. Well, the compilers I've used will put it in a register, but do extra work (usually unnecessary) to clear the higher bits. This is unfortunate. >Is there ever any reason to declare a variable `register char' rather than >`register int'? If the range of the variable really is char (so EOF is excluded), then it logically should be declared char. I find it distasteful to write something I don't mean just because it's more efficient than what I'd like*. If the machine has some one-byte registers available, `register char' is clearly a good idea (assuming the compiler has any brains). If the machine has only full-word registers but allows byte access to them, `register char c0, c1, c2, c3' could be packed into a single register; even on a VAX there are some situations where the packing/unpacking cost is negligible (for non-numerical usage, e.g.), and it saves on registers. I don't know of any machines that do this. Karl W. Z. Heuer (ima!haddock!karl; karl@haddock.isc.com), The Walking Lint *Like the keyword `register' itself, which is a crutch for dumb compilers.