It is important to know that some of the non-underscored functions are part of the C standard (e.g, fwrite
is specified in C11, §7.21.8.2), while others are specified in the POSIX standard, and are not part of the C standard (e.g. strdup
).
Now Windows is not 100% POSIX-compliant, so these POSIX-like functions may or may not behave according to the POSIX specification. It is quite possible that some C application that relies on POSIX behavior of these functions may compile but not run on Windows or run but work incorrectly.
To try to prevent this, MSVC greets you with a warning every time you try to use them:
warning C4996: 'strdup': The POSIX name for this item is deprecated.
Instead, use the ISO C++ conformant name: _strdup. See online help for
details.
Now, although this sounds like _strdup
is standardized by ISO, it is not; it's just weaselease for "Each name that begins with an underscore is reserved to the implementation", [lib.global.names]/2.
Microsoft is basically offering you another name, _strdup
, which does not come with the POSIX baggage attached to it. You probably won't find it on any other platform, though.
In the end, there is only one implementation, _strdup
, the linker simply maps strdup
to _strdup
(see oldnames.lib).