Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!mordor!styx!ames!amdahl!oliveb!sun!david From: david@sun.uucp (David DiGiacomo) Newsgroups: comp.lang.c Subject: Re: cpp of Sun's Unix version 3.2. Message-ID: <17801@sun.uucp> Date: Fri, 1-May-87 13:03:25 EDT Article-I.D.: sun.17801 Posted: Fri May 1 13:03:25 1987 Date-Received: Sun, 3-May-87 01:20:56 EDT References: <641@gama.is.tsukuba.junet> Organization: Sun Microsystems, Inc. - Mtn View, CA Lines: 35 In article <641@gama.is.tsukuba.junet> yoshiki@gama.is.tsukuba.junet (Yoshiki Watanabe) writes: >I have a trouble on cpp of Sun's Unix version 3.2. I tryed to expand a text >like the following. > ># define Macro(f) f > >Macro(Func(a, ># ifdef B > b, ># endif > c)) > >I want to get Func(a, c) if B is not defined... > >I can get what I want by other cpps (4.2BSD on VAX and Sequent). Is this a >bug of the cpp, or dependent on implementation? As Guy has pointed out, it is implementation dependent. However, there is an easy way to get the result you want out of the Sun/SystemV cpp if you don't mind defining an extra macro: #define Macro(f) f #ifdef B #define IFB(x) x, #else #define IFB(x) #endif Macro(Func(a, IFB(b) c) -- David DiGiacomo, Sun Microsystems, Mt. View, CA sun!david david@sun.com