Article View: comp.std.c
Article #2662Re: More Re: Function Argument Evaluation argument
From: Christopher R Volpe
Date: Tue, 02 Apr 1991 13:24
Date: Tue, 02 Apr 1991 13:24
26 lines
1263 bytes
1263 bytes
In article <RJOHNSON.91Apr1142143@olorin.shell.com>, rjohnson@shell.com
(Roy Johnson) writes:
|>I understand that the comma operator is a sequence point.
|>If we use the comma operator as a sequence point between evaluations:
|>
|> int v=1;
|> printf("%d %d\n", (1, v), (1,v++));
|>
|>This can print
|> 1 1
|>or
|> 2 1
|>
|>Do I win? 8^)
Hey, that looks pretty good. No matter what the order of evaluation of
the function arguments is, there's always a sequence point separating the
references to v. So the behavior is not undefined, yet order of evaluation
definitely has a drastic effect on the output.
Anybody see a problem with that?
==================
Chris Volpe
G.E. Corporate R&D
volpecr@crd.ge.com
Technical Details
Message-ID:
<18140@crdgw1.crd.ge.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!camelback!volpeReferences:
<17936@crdgw1.crd.ge.com> <15607@smoke.brl.mil> <RJOHNSON.91Apr1142143@olorin.shell.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!camelback!volpe From: volpe@camelback.crd.ge.com (Christopher R Volpe) Newsgroups: comp.std.c Subject: Re: More Re: Function Argument Evaluation argument Message-ID: <18140@crdgw1.crd.ge.com> Date: 2 Apr 91 13:24:16 GMT References: <17936@crdgw1.crd.ge.com> <15607@smoke.brl.mil> <RJOHNSON.91Apr1142143@olorin.shell.com> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@camelback.crd.ge.com (Christopher R Volpe) Lines: 26