Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!brl-tgr!tgr!gea%Romeo@cit-hamlet.arpa From: gea%Romeo@cit-hamlet.arpa Newsgroups: net.lang.c Subject: Register short Message-ID: <66@brl-tgr.ARPA> Date: Tue, 26-Nov-85 02:14:11 EST Article-I.D.: brl-tgr.66 Posted: Tue Nov 26 02:14:11 1985 Date-Received: Wed, 27-Nov-85 05:47:18 EST Sender: news@brl-tgr.ARPA Lines: 26 Actually, 'register short' can be a useful construct if your compiler knows what to do with it. I had a loop doing a checksum and wanted to keep the sum in a register. If I declared it as 'register int' (this is on a VAX), I got code looking like: ; R11 = pointer to array of shorts to be checksummed ; R10 = working sum CVTWL (R11)+,R0 ADDL2 R10,R0 whereas if I declared the sum as 'register short' the loop body was ADDW2 R10,(R11)+ [Apologies if my assembler syntax isn't perfect, it's been a while -- and I know these don't produce exactly the same result, but I had a short to store the checksum in, so the second was actually what I wanted]. The point is that there can be some benefit to compilers supporting 'register short' and 'register char' -- a lot of unnecessary conversions can be eliminated. (This was done on a VMS machine using INTERactive Systems' compiler). Gary Ansok