Since Cygwin has SG_WINDOWS defined but is likely to expose a POSIX or
GNU-like interface, using _WIN32 to decide whether Windows-specific
functions are available seems more appropriate than SG_WINDOWS to me.
// errno_t strerror_s( char *buf, rsize_t bufsz, errno_t errnum );
// size_t strerrorlen_s( errno_t errnum );
-#if defined(SG_WINDOWS)
+#if defined(_WIN32)
errno_t retcode;
// Always makes the string in 'buf' null-terminated
retcode = strerror_s(buf, sizeof(buf), errnum);
std::ostringstream ostr;
ostr << errnum;
-#if !defined(SG_WINDOWS)
+#if !defined(_WIN32)
if (retcode == ERANGE) { // more specific error message in this case
msg = std::string("buffer too small to hold the error message for "
"the specified error number");
BOOST_AUTO_TEST_CASE( error_string )
{
-#if defined(SG_WINDOWS)
+#if defined(_WIN32)
_set_errno(0);
#else
errno = 0;
std::ifstream f("/\\/non-existent/file/a8f7bz97-3ffe-4f5b-b8db-38ccurJL-");
-#if defined(SG_WINDOWS)
+#if defined(_WIN32)
errno_t saved_errno = errno;
#else
int saved_errno = errno;