Article View: comp.sys.atari.st
Article #37370Re: argument passing in C.
From: pa2183
Date: Fri, 24 Mar 1989 20:12
Date: Fri, 24 Mar 1989 20:12
25 lines
1207 bytes
1207 bytes
Several items recently have mentioned argument processing in C. Since the order of evaluation is un-defined, one must always check such details when porting or creating code which uses such side-effects. To further the confusion, the C ',' (comma) operator is defined to cause the following to be evaluated from left to right: ( a = b + c, c = a + b ); Where as the following evaluation order is undefined by the language: do_function( a = b + c, c = a + b ); The right to left evaluation and stacking mechanism in many C's allows the variable argument functions like 'printf' to work with out special code to find the number of arguments. I program in C because of the flexibility. Sometimes that flexiblity will lead to constructs which are not well-defined. Such is life. PS. I even used a C 'goto' once.
Technical Details
Message-ID:
<1352@sdcc15.ucsd.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!sdcc6!sdcc19!sdcc15!pa2183Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!sdcc6!sdcc19!sdcc15!pa2183 From: pa2183@sdcc15.ucsd.edu (pa2183) Newsgroups: comp.sys.atari.st Subject: Re: argument passing in C. Keywords: C arguments comma operator Message-ID: <1352@sdcc15.ucsd.edu> Date: 24 Mar 89 20:12:29 GMT Organization: University of California, San Diego Lines: 25