I have confusions about what implementation of errno() should I use in my programs.
As far as I know, the standard errno() is defined in errno.h. However, Visual Studio also has errno() in stdlib.h. Maybe that’s incorrect, but for me stdlib.h’s errno() is faster than errno.h’s one. But errno() is also defined in stddef.h.
Which one should I use? #ifdef _WIN32 #include <stdlib.h> #else #include <errno.h> #endif?
In C, use
errno.hand in C++ usecerrnoheader.errnocan be defined in other headers for convenience but for maximum portability you should use the ones above.