Fancy preprocessor stuff

William E. Davidsen Jr davidsen at steinmetz.ge.com
Tue May 10 23:44:15 AEST 1988


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 at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list