Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!usc!aero!aerospace.aero.org!lmiller From: lmiller@aerospace.aero.org (Lawrence H. Miller) Newsgroups: comp.lang.c Subject: Re: C's Limited Macro Capabilities Message-ID: <62664@aerospace.AERO.ORG> Date: 4 Dec 89 19:54:31 GMT References: <69517@psuecl.bitnet> Sender: news@aerospace.aero.org Reply-To: lmiller@batcomputer.UUCP (Lawrence H. Miller) Organization: The Aerospace Corporation, El Segundo, CA Lines: 20 In article <69517@psuecl.bitnet> bpm@psuecl.bitnet (Brian Moquin) writes: That he thinks macros like this would be useful: > #define cast(flag,x) #if flag=='I' \ > ((int)(x)) \ > #elif flag=='F' \ > ((float)(x)) \ > #endif >This is not legal C, but if it were I think it would enhance the power >of macro expansions significantly. Thoughts? But for each such example, you can easily write a macro that is legal. Why not just have your macro do what you really want, which is casting an expression to a type: #define cast(type,x) ((type)(x)) Larry Miller