Xref: utzoo comp.lang.c:38049 comp.std.c:4634 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!news.iastate.edu!john From: john@iastate.edu (Hascall John Paul) Newsgroups: comp.lang.c,comp.std.c Subject: Re: difference between c++; and ++c; Keywords: pre post increment decrement grammar style Message-ID: <1991Apr8.190629.2195@news.iastate.edu> Date: 8 Apr 91 19:06:29 GMT References: <1991Apr08.161444.10025@cs.ruu.nl> Sender: news@news.iastate.edu (USENET News System) Organization: Iowa State University, Ames, IA Lines: 30 hnridder@cs.ruu.nl (Ernst de Ridder) asks why: } ++c; }instead of } c++; Consider for a moment (yes, these are not equivalent): x = ++c; vs x == c++; These can be "compiled" as: temp_001 <-- c; c <-- c + 1; c <-- c + 1; x <-- c; x <-- temp_001; (now throw away the "x=" part (last "instruction"). So, "++c" is ``cleaner'' in some pedantic sense[1], and I suppose a sufficiently lacking compiler might actually produce slower code for "c++;" than for "++c;". John [1] I am one of those "guilty" of using "++c;" -- John Hascall An ill-chosen word is the fool's messenger. Project Vincent Iowa State University Computation Center john@iastate.edu Ames, IA 50011 (515) 294-9551