For socket/thread programming: Boost or Posix, which is better?

This is a discussion on For socket/thread programming: Boost or Posix, which is better? within the C++ Programming forums, part of the General Programming Boards category; If you want to write multi-thread programs or network programs in Unix, would you choose Boost::TR1 or posix's p_thread, socket ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    284

    For socket/thread programming: Boost or Posix, which is better?

    If you want to write multi-thread programs or network programs in Unix, would you choose Boost::TR1 or posix's p_thread, socket functions?
    Which is better? My another concern is that if I use boost too much and forget how to write a posix based program, will that be harmful to my future career as a system programmer?

    Thanks.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Boost::TR1 doesn't offer threads or networking. You mean Boost.Threads and Boost.Asio.

    Boost is far superior IMO, because it takes care of platform differences and boilerplate code, and because it offers a far more idiomatic interface than the C APIs of POSIX. Safer, too.

    I find the notion that you might forget the POSIX APIs to a point where you can't re-learn them within a day quite absurd.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    284
    Thanks for your reply. I don't see anything absurd. Just like you may use mutex everyday, but you may not remember its assemble language counterpart.

    Quote Originally Posted by CornedBee View Post
    Boost::TR1 doesn't offer threads or networking. You mean Boost.Threads and Boost.Asio.

    Boost is far superior IMO, because it takes care of platform differences and boilerplate code, and because it offers a far more idiomatic interface than the C APIs of POSIX. Safer, too.

    I find the notion that you might forget the POSIX APIs to a point where you can't re-learn them within a day quite absurd.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    You may forget the exact order of the function parameters, but you do that all the time for various functions anyway. Just look them up in a reference.
    What you won't forget is the general principles.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,246
    Quote Originally Posted by meili100 View Post
    If you want to write multi-thread programs or network programs in Unix, would you choose Boost::TR1 or posix's p_thread, socket functions?
    Which is better? My another concern is that if I use boost too much and forget how to write a posix based program, will that be harmful to my future career as a system programmer?

    Thanks.
    "System programmers" are probably not using Boost, because they're probably not even using C++. But yes, not knowing the POSIX interfaces is a huge detriment to writing system code. Boost sockets are interesting but Boost is not available everywhere yet. And a lot of programming shops do not use it because of portability fears. So if all you know is Boost, then you will literally not be able to operate whatsoever in a lot of environments.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    >> So if all you know is Boost, then you will literally not be able to operate whatsoever in a lot of environments.

    Until you learn or remember the other stuff, which shouldn't be that hard especially if you've used it before.

    Not using a new tool that is better for the current job because you're afraid of forgetting the old tool if you ever need it again makes little sense IMO.

  7. #7
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,246
    Quote Originally Posted by Daved View Post
    >> So if all you know is Boost, then you will literally not be able to operate whatsoever in a lot of environments.

    Until you learn or remember the other stuff, which shouldn't be that hard especially if you've used it before.

    Not using a new tool that is better for the current job because you're afraid of forgetting the old tool if you ever need it again makes little sense IMO.
    I didn't mean to imply the OP shouldn't learn Boost sockets. Just that I would not accept that as a substitute for knowledge of the POSIX standard. I don't have everything memorized either, but I remember the ideas.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. boost posix time question
    By l2u in forum C++ Programming
    Replies: 4
    Last Post: 03-05-2008, 12:31 PM
  2. Boost Auto-Linking
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 12-30-2007, 05:11 AM
  3. Replies: 2
    Last Post: 12-12-2007, 05:45 AM
  4. building boost iostreams
    By l2u in forum C++ Programming
    Replies: 3
    Last Post: 04-14-2007, 02:29 PM
  5. Integrating Boost with STLPort
    By Mario F. in forum Tech Board
    Replies: 1
    Last Post: 11-11-2006, 05:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21