Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions include/boost/compute/detail/parameter_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <boost/compute/version.hpp>

#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE
#include <cstdio>
#include <boost/algorithm/string/trim.hpp>
#include <boost/compute/detail/path.hpp>
#include <boost/property_tree/ptree.hpp>
Expand Down Expand Up @@ -117,9 +118,16 @@ class parameter_cache : boost::noncopyable
static std::string version_string()
{
char buf[32];
std::snprintf(buf, sizeof(buf), "%d.%d.%d", BOOST_COMPUTE_VERSION_MAJOR,
BOOST_COMPUTE_VERSION_MINOR,
BOOST_COMPUTE_VERSION_PATCH);
// snprintf is in Visual Studio since Visual Studio 2015 (_MSC_VER == 1900)
#if defined (_MSC_VER) && _MSC_VER < 1900
#define DETAIL_SNPRINTF sprintf_s
#else
#define DETAIL_SNPRINTF std::snprintf
#endif
DETAIL_SNPRINTF(buf, sizeof(buf), "%d.%d.%d", BOOST_COMPUTE_VERSION_MAJOR,
BOOST_COMPUTE_VERSION_MINOR,
BOOST_COMPUTE_VERSION_PATCH);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's any utilities somewhere in Boost for doing this platform-specific stuff..

#undef DETAIL_SNPRINTF
return buf;
}

Expand Down
2 changes: 1 addition & 1 deletion test/test_lambda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(result_of)
float(2.0f), float(3.0f), int4_(0, 1, 2, 3)
);

check_lambda_result<int4_>(isinf(_1), float4_(0, 1, 2, 3));
check_lambda_result<int4_>(bc::lambda::isinf(_1), float4_(0, 1, 2, 3));

check_lambda_result<int>(_1 + 2, int(2));
check_lambda_result<float>(_1 + 2, float(2.2f));
Expand Down