comma operator

Tom Stockfisch tps at chem.ucsd.edu
Sun Aug 6 16:34:32 AEST 1989


In article <1351 at cbnewsl.ATT.COM> mpl at cbnewsl.ATT.COM (michael.p.lindner) writes:
>> > >		fprintf(stderr, "Can't open %s\n", file), exit(2);

>Sigh.  RTFM!  The comma operator guarantees left to right evaluation,
>and fprintf(...) and exit(...) ARE valid expressions in C.

This is valid dpANS code, but it is not currently portable.

Many C compilers do not allow void operands of comma operators.
Many libraries also declare exit() to return void.
Systems that do both will not accept the above statement.
-- 

|| Tom Stockfisch, UCSD Chemistry	tps at chem.ucsd.edu



More information about the Comp.lang.c mailing list