Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!bu.edu!snorkelwacker!spdcc!merk!alliant!linus!think!compass!worley From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.fortran Subject: Using cpp for macro substitution. Message-ID: <2389@compass.com> Date: 9 Jul 90 15:24:42 GMT Organization: Compass, Inc., Wakefield, MA Lines: 24 In-reply-to: quinlan@physics.utoronto.ca's message of 6 Jul 90 20:21:54 GM quinlan@physics.utoronto.ca (Gerald Quinlan) writes: > I have a question about using the C preprocessor to perform macro > substitutions in a Fortran program. > #define CALL_ADD(a,b,sum,error)\ > dum=a+b \ > [etc.] > Note how cpp has combined all the statements of the macro into one long line. There is no way to get around this with CPP. The problem is that CPP macro definitions are exactly one line long. (CPP is line-oriented like Fortran, despite that C is not!) The backslashes at the ends of lines are really escape characters that mean "delete the newline that follows me". Since the deletion of the newline is in a (logical) processing pass before CPP's macro processing, it is impossible to get one outputed. Thus, it is impossible to have the output of a macro span more than one line. Oddly, a macro *call* is allowed to span more than one line. Dale Worley Compass, Inc. worley@compass.com -- It is easier to get forgiveness than permission.