[ZOOM] C++ pointers

Jacob Chr. Poulsen ja7 at dbc.dk
Thu Nov 1 22:29:56 CET 2001


Hi. 

I am nust starting to look into ZOOM, (adams request) and there 
forre, must apoligice for any misonderstanding of the proposed standard 
as i don't understand. 

but the stuff about pointers i know. 

On Thu, Nov 01, 2001 at 03:14:03PM +0000, Mike Taylor wrote:
> > Date: Thu, 1 Nov 2001 15:04:10 +0000
> > From: Ashley Sanders <zzaascs at irwell.mimas.ac.uk>
> > 
> > > If we go the way we seem to be going with the resultSet constructor,
> > > then we will presumably do the same with the record constructor, which
> > > will replace the resultSet::getRecord() method.  Then your code could
> > > be written:
> > > 
> > > 	for (size_t sz = 0; sz < rs.size (); ++sz)
> > > 	  cout << record(rs, sz)->field ("title") << endl;
> > > 
> > > At least, I think it can.
> > 
> > No. For the polymorphic behaviour we've designed into
> > the record heirarchy you need a reference or a pointer.
> > Stroustup, 3rd ed, page 312.
> 
> Right.
> 
> > Personally I feel more at ease with pointers, but that's probably
> > because I started off with C.
> 
> Me too, but& I &admit I am beginning to understand& some of& the reasons
> why most C++ program &look& like someone's &sprinkled a handful& of
> ampersands &liberally over them& :-)

& is just a pointer with out the evil null checks. so in my apinion this code 
shut be somthing like

   for( size_t sz = 0; sz < rs.size(); ++ sz) 
      cout << rs[sz].field("title") << end;

or the more nice version for indexing tith strings. 
   
   for(size_t sz = 0; sz < rs.size(); ++ sz) 
      cout << rs[sz]["title] << endl;


This is just as nice as any one wants C to be :) 

ps. i will send a hallo mail to the list as soon as i get on it :)

-- 
mvh. Jacob Chr Poulsen
  ja7 at dbc.dk
--- Det Er ingen skam at være ordblid, med holdkeft hvor er det besverligt.
--- it's no chame for a word-bliend not beeing abel to spell duslexica.




More information about the ZOOM mailing list