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 33,206 of 33,346    |
|    fmatthew5876 to All    |
|    Re: Returning a char* pointer    |
|    14 Sep 13 04:01:47    |
   
   From: fmatthew5876@googlemail.com   
      
   { Reformatted; please limit your lines to 70 characters -mod }   
      
   > If that is the only problem for you then there are compiler-specific   
   > extensions ('__thread', '__declspec( thread )') or third party libs   
   > ('boost::thread_specfic_ptr<>') to make the idiom thread safe again.   
      
   I'm not sure its a good idea to just throw thread local variables all   
   over the place. Every thread local variable you create adds to the   
   memory overhead of each thread. If everyone was doing this then we   
   would have to pay a lot of memory for functions most threads may not   
   even call.   
      
   > Foo* foo = getItFromSomewhere();   
   > char const* p = foo ? foo.toString() : "***Missing Foo***";   
   > printf("FOO IS %s\n", p);   
   >   
   >   
   > That is nasty bear trap, author won't gain good fame.   
      
   Indeed, its probably better to just force the user to create the   
   buffer themselves.   
      
   --   
    [ 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