aspose file tools*
The moose likes C / C++ and the fly likes Porting pre-C++11 code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Porting pre-C++11 code" Watch "Porting pre-C++11 code" New topic
Author

Porting pre-C++11 code

Bjorn Roche
Greenhorn

Joined: Oct 27, 2009
Posts: 4
Hey there,

I have a bunch of multithreaded C++ code (using pthreads, unix style mutexes, OS specific memory barriers and such). Does your book cover strategies for porting existing C++ code to the new C++11 standard? Or is it simply a matter of replacing constructs one at a time? Any general advice? Thanks, and welcome to the ranch!

bjorn


www.xowave.com
www.xoaudio.com
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 57
Bjorn Roche wrote:I have a bunch of multithreaded C++ code (using pthreads, unix style mutexes, OS specific memory barriers and such). Does your book cover strategies for porting existing C++ code to the new C++11 standard? Or is it simply a matter of replacing constructs one at a time? Any general advice?


There is an appendix which shows the correspondence between various thread libraries (including POSIX threads) and the C++11 thread library, and the relevant chapter for details, but no specific advice about porting. I would go for a piecemeal approach, replacing each construct in turn: code that uses the C++11 thread library should work quite nicely alongside code that uses the raw platform API, and you should be able to use POSIX mutexes on threads spawned with std::thread, and std::mutex on threads spawned with pthread_create (for example).


Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/
just::thread C++11 thread library http://www.stdthread.co.uk
Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Porting pre-C++11 code