Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <7082@brl-smoke.ARPA> Date: 14 Jan 88 10:21:44 GMT References: <3819@sigi.Colorado.EDU> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 21 In article <3819@sigi.Colorado.EDU> swarbric@tramp.Colorado.EDU (SWARBRICK FRANCIS JOHN) writes: >So, what is the advantage of using the comma operator other than to squeeze >everything on to one line? There are two primary legitimate uses for the comma (sequencing) operator, typified by: for ( i = n, p = array; *p != 0; --i, ++p ) ; where the comma operator permits multiple operations in each part of the for(), and #ifndef lint #define MmAllo( t ) ((t *)Mm_QAllo( sizeof(t) )) #else #define MmAllo( t ) ((void)Mm_QAllo( sizeof(t) ), (t *)0) #endif where the comma operator permits multiple operations in producing a single value for an expression.