Article View: net.lang.c
Article #9297Re: soundex algorithm wanted
From: BALDWIN
Date: Thu, 11 Sep 1986 17:43
Date: Thu, 11 Sep 1986 17:43
19 lines
1526 bytes
1526 bytes
> 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. 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
Technical Details
Message-ID:
<1244@whuxl.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!mikeReferences:
<27@houligan.UUCP> <672@bnrmtv.UUCP> <1239@whuxl.UUCP> <3266@umcp-cs.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site whuxl.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!mike From: mike@whuxl.UUCP (BALDWIN) Newsgroups: net.lang.c Subject: Re: soundex algorithm wanted Message-ID: <1244@whuxl.UUCP> Date: Thu, 11-Sep-86 13:43:27 EDT Article-I.D.: whuxl.1244 Posted: Thu Sep 11 13:43:27 1986 Date-Received: Fri, 12-Sep-86 07:34:24 EDT References: <27@houligan.UUCP> <672@bnrmtv.UUCP> <1239@whuxl.UUCP> <3266@umcp-cs.UUCP> Organization: AT&T Bell Laboratories, Whippany Lines: 19