switch question in recog.c

Nix nix@esperi.org.uk
Mon Oct 13 02:15:00 GMT 2003


On Tue, 7 Oct 2003, Zack Weinberg moaned:
> "For maximum obfuscation, the outer braces can be removed":

The most extreme example of this I've ever seen came from the
UNIX-HATERS archives, attributed to Harbison and Steele's "C: A
Reference Manual".. I'm sure that everyone looking at this will
agree that it is a nice clear and sensible micro-optimization:

  switch (x)
    default:
      if (prime(x))
        case 2: case 3: case 5: case 7:
	  process_prime(x);
      else
        case 4: case 6: case 8: case 9: case 10:
	  process_composite(x);

-- 
`If you want a vision of the future, it is a wireless broadband network
 feeding requests for foreign money-laundering assistance into a human
 temporal lobe, forever. With banner ads.' --- John M. Ford



More information about the Gcc mailing list