Xref: utzoo comp.os.vms:40108 comp.lang.c:40251 Newsgroups: comp.os.vms,comp.lang.c Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!snorkelwacker.mit.edu!bloom-picayune.mit.edu!news From: mlevin@jade.tufts.edu Subject: problem with /define in VAX C: help! Message-ID: <1991Jun20.030147.3867@athena.mit.edu> Sender: news@athena.mit.edu (News system) Organization: Me, Myself, and I, inc. Distribution: usa Date: Thu, 20 Jun 91 03:01:47 GMT Lines: 27 I have the following problem. I want to do conditional compilation, based on the value of a variable given at compile time. On a Unix system, if I have the program: main() { enum {AA, BB, CC} dd; dd = DEF; #if DEF!=CC printf("%d\n",dd); #endif } And I compile it with: "cc a.c -DDEF=BB", the program will print out 1 when it runs, because DEF is assigned the enum value BB, which is not equal to the enum value CC, so the printf goes in. But, on a VMS system with Vax C, when I do cc a.c /define="DEF=BB", the printf is never put in. I think it is because the compiler thinks DEF and CC are both undefined at the point of the #if, assigns them both to 0, and they are thus always equal (so the printf never gets put in). Am I missing something (as usual)? Or is this a genuine difference between Unix and Vax C compilers? In any case, I'd appreciate any help on how I can do this in Vax C: I need to pass in an enum value during compile-time. Please direct all suggestions to mlevin@jade.tufts.edu. Mike Levin