home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,903 of 33,346   
   Zeljko Vrba to Richard Smith   
   Re: Politics of using the standard libra   
   11 Feb 12 16:33:39   
   
   From: mordor.nospam@fly.srk.fer.hr   
      
   On 2012-02-10, Richard Smith  wrote:   
   >   
   > I'm doing some coding in my spare time on an open source C++ project   
   > which I won't name the project to avoid any embarrassment.  The code   
   >   
   Actually, a better advice, IMO.  Given this, I assume that you're not   
   being payed, i.e., you don't rely on income from this project. If true,   
   this means you have a MUCH greater freedom in what you can do than you   
   would have had otherwise.   
      
   So: don't do anything, just start using the standard library on your own.   
   When you discover a bug (e.g., memory leak), fix it by using scoped_ptr   
   instead of adding delete.  Etc.  You might eventually be kicked out of   
   the project, but would it really be a big deal?   
      
   PS: STL is unpredictable; I got burned on it myself.  IIRC, I had a   
   vector of structures like this one:   
      
   struct pair {   
     int a, b, c;   
     pair(int _a, int _b) : a(_a), b(_b)   
     { }   
   }   
      
   I frequently called vector.clear, which turned out to be a severe   
   performance bottleneck: you would expect clear to be O(1) since the   
   destructor is empty, but it obviously wasn't: reducing the vector size   
   from 1024 to 17 made an orders of magnitude improvement in running   
   time (the vector was used as a storage for open-addressing hashing   
   scheme).  Also, some memory reallocations were going on there.   
      
   In conclusion: if performance is critical, you cannot rely on the STL   
   and the compiler to always do the "sane thing".   
      
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca