From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,cb40752a27f3d651 X-Google-Attributes: gid1014db,public X-Google-Thread: fee84,cb40752a27f3d651 X-Google-Attributes: gidfee84,public X-Google-Thread: 1164f8,cb40752a27f3d651 X-Google-Attributes: gid1164f8,public From: fred@genesis.demon.co.uk (Lawrence Kirby) Subject: Re: comma operator: C compiler bug or bogus usage? Date: 1999/04/15 Message-ID: <924201978snz@genesis.demon.co.uk>#1/1 X-Deja-AN: 466808270 References: <7f567v$sp1$1@news.iastate.edu> X-Complaints-To: abuse@demon.net X-Mail2News-Path: news.demon.net!genesis.demon.co.uk X-Trace: mail2news.demon.co.uk 924200999 mail2news:14234 mail2news mail2news.demon.co.uk Organization: none Reply-To: fred@genesis.demon.co.uk Newsgroups: comp.lang.c,comp.unix.osf.osf1,comp.sys.dec In article <7f567v$sp1$1@news.iastate.edu> john@iastate.edu "John Hascall" writes: ... >It seems to me that the first error message is clearly not helpful, >but what haven't been able to discover is: > > Is the result of: > > constant-expression comma-operator constant-expression > > still a constant-expression or not? If not, why not (and it > seems to me this is the only operator with this property?) The C standard says "Constant expressions shall not contain assignment, increment, decrement function-call, or comma operators, except when they are contained within the operand of a sizeof operator." >John >PS, FWIW, gcc accepts both of these and produces the 'expected' results By default the language that gcc compiles is not C, it is what is loosely called "GNU C" which includes a numbver of extensions over standard C. Use gcc -ansi -pedantic to make gcc an essentially standard C compiler. If you do you should find that it warns about your code. -- ----------------------------------------- Lawrence Kirby | fred@genesis.demon.co.uk Wilts, England | 70734.126@compuserve.com -----------------------------------------