Xref: utzoo comp.lang.c:35314 comp.std.c:4135 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!dkuug!resam!andrew From: andrew@resam.dk (Leif Andrew Rump) Newsgroups: comp.lang.c,comp.std.c Subject: Is it only ANSI C that allow #if to compare symbols? Keywords: sun C #if Message-ID: <1991Jan18.170921.4866@resam.dk> Date: 18 Jan 91 17:09:21 GMT Distribution: comp Organization: RESAM Project Office, SAS, CPHML-V Lines: 41 Hello netters - please help me with this one - this will be the last one - and if you believe that then I have an Eiffeltower to sell you!!! :-) I tried this construction on our Sun C compiler (please no flames!): #define FOLDER fk ... #ifdef FOLDER part 1 #endif ... #if FOLDER == fk part 2 #endif It worked OK for part 1 i.e. if FOLDER is defined (never mind it's value) then part 1 if compiled but part 2 get compiled under any circumstances _even_ if you only define one of two symbols and write: #ifdef FOLDER == CASE part 2 #endif So this rules out that the presence is equal 1 and absence equal 0! The manual states "#if constant-expression ... All binary non-assign= ment C operators, including '&&', '||' and ',', are legal ... The '?:' operator, and the unary '-', '!', and '~' operators, are also ..." Is there any other way I may check a symbols value? Any suggestions? Leif Andrew Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark UUCP: andrew@ambra.dk, phone: +45 39 27 11 77 / Currently at Scandinavian Airline Systems =======/ UUCP: andrew@resam.dk, phone: +45 32 32 51 54 \ SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark > > Read oe as: o / (slash) and OE as O / (slash) < <