Short code to determine compiler's

John Hascall hascall at atanasoff.cs.iastate.edu
Tue Jul 25 00:03:46 AEST 1989


In article <26470 at amdcad.AMD.COM> tim at amd.com (Tim Olson) writes:
>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?
>
>Yes, the register keyword does indicate such things, but they can all be
>determined by flow analysis anyway.

    There are times that the programmer has more information than the
    compiler, consider this code fragment for example:

	for(i=0; i<foo; i++) ...
	for(j=0; j<bar; j++) ...

    and suppose the programmer knows `foo' will be large and `bar' will be
    small, then hopefully `register int i' could be a hint to the
    compiler that the first loop will be executed many times more than
    the second--something it has no clue about.

    John Hascall
    ISU Comp Center



More information about the Comp.lang.c mailing list