Thread: inet_ntop reentrant?

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    17

    inet_ntop reentrant?

    I have been trying to find out if inet_ntop is reentrant or not. I seem to get varying responses on the different sites I found when googling.

    I am sure versions of the library matter but I am not exactly sure what version I have and am not sure how to tell. If someone can tell me how to find out the library version I can provide that info as well.

    Thanks for the help.

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by stevfletchcom View Post
    I have been trying to find out if inet_ntop is reentrant or not. I seem to get varying responses on the different sites I found when googling.

    I am sure versions of the library matter but I am not exactly sure what version I have and am not sure how to tell. If someone can tell me how to find out the library version I can provide that info as well.

    Thanks for the help.
    Unlike inet_ntoa, inet_ntop takes a pointer to the result buffer. The reason this was done was almost certainly to provide re-entrancy.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    17
    Thanks for the reply. That helps out a lot. It eliminates a large possible area of bugs for me in the code.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    17
    Another related question.

    Is there an easy way to tell if a library function is threadsafe and or reentrant?

    I have some callback functions that need to be thread safe and reentrant, apparently there is a difference between the two, and I am not sure if I can use some standard library functions within the callback functions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reentrant Message Processing (WndProc)
    By phantomotap in forum Windows Programming
    Replies: 7
    Last Post: 04-28-2009, 10:44 AM