[comp.lang.c] Fancy preprocessor stuff

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (05/10/88)

Here's a question for the preprocessor guru in you:

  I have a program which has it's source in SCCS. I want to take some
action if the compiled source is a non-production version (extracted
from the SCCS base with -e, keywords not expanded). I know how to do
this easily at runtime, but what I really want is the do it in the
preprocessor.

Here's what I do at runtime:

  flag = atoi("%R%");
  if (flag) { /* productions version */ }
  else      { /* development version */ }

  I suspect that there's a neat way to avoid generating all that code,
and doing the test in inner loops. Here's your chance to show how well
you understand the preprocessor.

  One last restriction: must be portable and ANSI compliant, valid in
(at least) BSD, SysV, VMS and MSC.
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me