Xref: lugnet.com lugnet.robotics.rcx.nqc:123 Newsgroups: lugnet.robotics.rcx.nqc Path: lugnet.com!dbaum From: dbaum@spambgoneenteract.com (Dave Baum) X-Real-Life-Name: Dave Baum Subject: Re: NQC 2 Request X-Newsreader: MT-NewsWatcher 2.4.4 Organization: None Message-ID: References: <37DE2468.66B220C4@sundayta.co.uk> X-Nntp-Posting-Host: 207-229-150-88.d.enteract.com Date: Wed, 15 Sep 1999 23:38:35 GMT Lines: 24 In article <37DE2468.66B220C4@sundayta.co.uk>, David Warnock wrote: >I just wondered whether it might be handy to add OnFwdFor(motors) and >OnRevFor(motors). > If anyone wants to add these functions into their own code... void OnFwdFor(const int m, const int &t) { Fwd(m); OnFor(m, t); } void OnRevFor(const int m, const int &t) { Rev(m); OnFor(m, t); } These should be efficient - everything will be inlined and no temporaries will be created - unless a temporary is needed during the computation of t... int x, y; OnFwdFor(x); // ok, no temporary OnFwdFor(x+y); // need temp to compute x+y Dave -- reply to: dbaum at enteract dot com