Short code to determine compiler's

Tim Olson tim at crackle.amd.com
Mon Jul 24 06:55:20 AEST 1989


In article <1038 at cernvax.UUCP> hjm at cernvax.UUCP (Hubert Matthews) writes:
| I have a question for the authors of smart C compilers: is the
| register declaration useful at all for such compilers?  It indicates
| that a variable is non-volatile, noalias and that taking its address
| is illegal, all of which should make things easier for the optimiser.

Yes, the register keyword does indicate such things, but they can all be
determined by flow analysis anyway.  If a local variable does not have
its address taken, and it is non-volatile, then it is equivalent to
"register".

| So, does "register" help or hinder?  Has it become a source-code
| "no-op"?  Can I merrily leave it out of my programs and let the
| compiler do the guessing for me :-).

It's a no-op, except for error messages that must be reported if a
register variable's address is taken.  In other words, it's more for
diagnostic purposes than performance in "smart" C compilers. 

	-- Tim Olson
	Advanced Micro Devices
	(tim at amd.com)



More information about the Comp.lang.c mailing list