Thread: strdup--> standard function or not?

  1. #1
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Nice, France

    strdup--> standard function or not?

    I found this old thread, where it says that one has the strdup defined in stdlib.h instead of the string.h , because it is not standard C.
    Compiler error: warning: implicit declaration of function 'strdup'

    I found this link for string.h ,where strdup is part of it

    I looked in another forum with good documentation,and it does not have it
    cstring (string.h) - C++ Reference

    So,is it standard or not?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    It's part of some standards, just not the ISO C standard.
    strdup(3): duplicate string - Linux man page

    See the "Conforming To" section.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strdup function is eating a letter
    By DeanWinchester in forum C Programming
    Replies: 15
    Last Post: 05-31-2012, 08:06 AM
  2. Is there a standard function?
    By frktons in forum C Programming
    Replies: 223
    Last Post: 07-16-2010, 03:31 PM
  3. Is there a standard C function to do this?
    By lucidrave in forum C Programming
    Replies: 9
    Last Post: 08-14-2009, 11:21 PM
  4. Replies: 15
    Last Post: 11-11-2007, 10:40 AM
  5. function: strdup()
    By cjtotheg in forum C Programming
    Replies: 3
    Last Post: 02-02-2002, 10:08 AM