当我发现它仅适用于Linux时,我正在研究Valgrind以帮助改进我的C编码/调试 - 我没有其他需要或兴趣将我的操作系统转移到Linux所以我想知道是否有一个同样好的Windows程序.
通过对这些库的粗略理解,它们看起来非常相似.我知道VexCL和Boost.Compute使用OpenCl作为后端(尽管v1.0版本VexCL也支持CUDA作为后端)并且Thrust使用CUDA.除了不同的后端,这些之间的区别是什么.
具体来说,他们解决了什么问题空间,为什么我要使用其中一个.
另外,在Thrust常见问题解答中说明了这一点
OpenCL支持的主要障碍是缺少OpenCL编译器和运行时支持C++模板
如果是这种情况,VexCL和Boost.Compute怎么可能存在.
class C {
private:
int member_; // here is the underscore I refer to.
}
Run Code Online (Sandbox Code Playgroud)
Google样式指南和Geosoft的C++样式指南推荐使用此下划线.
我知道有不同的意见和口味.
我想问一下使用它或者被迫使用它的人是否认为它们对它们有益,中性或有害.为什么?
这是我的答案:
我理解它背后的动机,但它并不能说服我.我尝试了它,我得到的只是整个类的一点点混乱,但构造函数中的成员初始化更简单.我没有遇到下划线帮助私有成员变量和其他变量之间有所不同的情况(除了提到的初始化).
在这方面,我认为这种风格有害.
我正在尝试获取本地网络计算机的列表.我尝试使用NetServerEnum和WNetOpenEnumAPI,但两个API都返回错误代码6118 (ERROR_NO_BROWSER_SERVERS_FOUND).不使用本地网络中的Active Directory.
奇怪的Windows资源管理器显示所有本地计算机没有任何问题
还有其他方法可以获取局域网中的计算机列表吗?
我正在寻找一种在VS2012中通过NatVis显示UUID的正确方法.我自己的uuid类型在内部使用UUID big-endian,因此转换为(GUID*)不起作用,因为GUID在Windows中使用little-endian.所以我总是看到一个歪曲的uuid.
此外,Natvis中的任何格式说明符看起来都不好,因为在使用十六进制表示法时我无法摆脱输出中的0x.有任何想法吗?
c++ debugging visual-studio-debugging visual-studio-2012 natvis
有什么建议?这篇SO帖子讨论了Visual Leak Detector,但我正在寻找其他工具.另外,请不要推荐这个.
c++ memory-leaks visual-c++ memory-leak-detector visual-leak-detector
如何以厘米或英寸为单位显示显示尺寸?
此代码并不总是正常工作:
HDC hdc = CreateDC(_T("DISPLAY"),dd.DeviceName,NULL,NULL);
int width = GetDeviceCaps(hdc, HORZSIZE);
int height = GetDeviceCaps(hdc, VERTSIZE);
ReleaseDC(0, hdc)
Run Code Online (Sandbox Code Playgroud)
特别适用于多显示器配置.
更新:我需要获得普通显示器的大小,它具有恒定的物理尺寸.
以下代码分别使用boost.compute和opencl c ++包装器添加两个向量.结果显示boost.compute比opencl c ++包装器慢近20倍.我想知道我是否错过使用boost.compute或它确实很慢.平台:win7,vs2013,提升1.55,boost.compute 0.2,ATI Radeon HD 4600
代码使用c ++包装器:
#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
#include <boost/timer/timer.hpp>
#include <boost/smart_ptr/scoped_array.hpp>
#include <fstream>
#include <numeric>
#include <algorithm>
#include <functional>
int main(){
static char kernelSourceCode[] = "\
__kernel void vadd(__global int * a, __global int * b, __global int * c){\
size_t i = get_global_id(0);\
\
c[i] = a[i] + b[i];\
}\
";
using type = boost::scoped_array<int>;
size_t const BUFFER_SIZE = 1UL << 13;
type A(new int[BUFFER_SIZE]);
type B(new int[BUFFER_SIZE]);
type C(new int[BUFFER_SIZE]); …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我收到此错误:
HEAP[App.exe]: HEAP: Free Heap block 61af0f0 modified at 61af194 after it was freed
Run Code Online (Sandbox Code Playgroud)
这是一个调用堆栈:
ntdll.dll!_RtlpBreakPointHeap@4() Unknown
ntdll.dll!@RtlpAllocateHeap@24() Unknown
ntdll.dll!_RtlAllocateHeap@12() Unknown
ntdll.dll!_RtlDebugAllocateHeap@12() Unknown
ntdll.dll!@RtlpAllocateHeap@24() Unknown
ntdll.dll!_RtlAllocateHeap@12() Unknown
> msvcr110d.dll!_heap_alloc_base(unsigned int size) Line 57 C
msvcr110d.dll!_heap_alloc_dbg_impl(unsigned int nSize, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 431 C++
msvcr110d.dll!_nh_malloc_dbg_impl(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp) Line 239 C++
msvcr110d.dll!_nh_malloc_dbg(unsigned int nSize, int nhFlag, int nBlockUse, const char * …Run Code Online (Sandbox Code Playgroud) c++ memory memory-leaks heap-corruption visual-leak-detector
Folly库要求std::atomic<hazptr_obj*>应该是一个简单的类型.这适用于gcc和clang,但即使对于Visual C++也是如此std::atomic<int>.为什么要std::is_trivial回来false?
#include <type_traits>
#include <atomic>
static_assert(
std::is_trivial<std::atomic<int>>::value,
"std::atomic<int> not trivial");
Run Code Online (Sandbox Code Playgroud) c++ ×8
memory-leaks ×3
c ×2
debugging ×2
visual-c++ ×2
winapi ×2
windows ×2
boost ×1
c# ×1
c++11 ×1
coding-style ×1
memory ×1
monitor ×1
natvis ×1
networking ×1
opencl ×1
thrust ×1
valgrind ×1
vexcl ×1