Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!amdcad!weitek!pyramid!thirdi!peter From: peter@thirdi.UUCP (Peter Rowell) Newsgroups: comp.lang.c Subject: Re: Calling multiple functions in a macro. Message-ID: <439@thirdi.UUCP> Date: 1 Nov 88 17:27:42 GMT References: <353@marob.MASA.COM> Reply-To: peter@thirdi.UUCP (Peter Rowell) Organization: Third Eye Software, Menlo Park, CA Lines: 24 In article <353@marob.MASA.COM> daveh@marob.masa.com (Dave Hammond) writes: >... >2. >#define FOO() foo1(), foo2(), foo3(), foo4() >... >The second compiles, executes and lints correctly (on Xenix), but >is it portable to string function calls in this manner? What you have is an expression using the comma operator. Expressions are one of the basic statement types in C. If this isn't portable using a given C compiler, then it isn't a C compiler. See K&R, pg 192, Appendix A, 7.15 "Comma operator" One suggestion: wrap the whole thing in parens to prevent any possible nasty side effects. #define FOO() (foo1(), foo2(), foo3(), foo4()) "... Comma comma comma come on, yeah yeah yeah..." James Taylor ---------------------------------------------------------------------- Peter Rowell Third Eye Software, Inc. (415) 321-0967 Menlo Park, CA 94025 ...!pyramid!thirdi!peter