To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 3744
3743  |  3745
Subject: 
RE: legOS development release imminent / C++
Newsgroups: 
lugnet.robotics
Date: 
Sun, 14 Feb 1999 17:24:24 GMT
Original-From: 
Paul Curtis <plc@rowley.%AntiSpam%co.uk>
Viewed: 
3392 times
  
Ben,

> Markus L. Noga wrote:
> > I'm worried about compactness with C++ in general. The code • generated by
> > this function is 76 bytes long:
> > 
> > void do_sensing_c() {
> >   int i;
> >   ds_active(&SENSOR_1);
> > 
> >   for(i=0; i<100; i++) {
> >     cputw(SENSOR_1);
> >     lcd_refresh();
> >     delay(20);
> >   }
> >   ds_passive(&SENSOR_1);
> > }
> > 
> > The exact same thing in C++ generates 232 bytes:
> > 
> > void do_sensing_cpp() {
> >   Sensor s(Sensor::s1,1);
> > 
> >   for(int i=0; i<100; i++) {
> >     cputw(s.value());
> >     lcd_refresh();
> >     delay(20);
> >   }
> > }
> > 
> > A factor of three. I'm not sure whether it's worth treading this
> path.
> 
> These don't look exactly the same to me, but without the definition of
> Sensor, its hard to say...
I think you'll find the destructor for Sensor effectively
encapsulates ds_passive().

-- Paul.


--
Did you check the web site first?: http://www.crynwr.com/lego-robotics



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR