soundex algorithm wanted

BALDWIN mike at whuxl.UUCP
Fri Sep 12 03:43:27 AEST 1986


> In article <1239 at whuxl.UUCP> mike at whuxl.UUCP (BALDWIN) writes:
> >	register char	c, lc, prev = '0';
> 
> All the compilers I have used ignore the `register' on `register
> char' declarations.  In any case, an `int' will hold everything
> that will fit in a `char', and is (usually) the `natural word size'
> of the machine.  Is there ever any reason to declare a variable
> `register char' rather than `register int'?  Are there any extant
> compilers for which the latter will generate *worse* code?

On a 3B20, `register char c' is indeed put in a register, and
generates exactly the same code as `register int c', except
the instruction is `cmpb' instead of `cmpw'.  Of course there's
a reason for declaring a variable as char instead of int; if it
is used as a char, it should be declared char.
-- 
						Michael Baldwin
			(not the opinions of)	AT&T Bell Laboratories
						{at&t}!whuxl!mike



More information about the Comp.lang.c mailing list