How to close the prefetch of cache in windows?
In a C/C++ program, how to close the prefetch of each core in the Windows system? ...
In a C/C++ program, how to close the prefetch of each core in the Windows system? ...
I'm seeing a weird thing when connecting to the performance registry on 64 bit editions of Windows. The whole program stalls and callstacks becomes unreadable. After a long timeout, the connection attempts aborts and everything goes back to normal. The only solution is to make sure that only one thread at the time queries the remote reg...
I'd like to set up a function pointer as a member of a class that is a pointer to another function in the same class. The reasons why I'm doing this are complicated. In this example, I would like the output to be "1" class A { public: int f(); int (*x)(); } int A::f() { return 1; } int main() { A a; a.x = a.f; printf("%d\n",a....
I'm looking for a way of doing a insensitive compare of two Unicode characters (char32) under Windows (C/C++, not .NET). I am aware that the solution is supposed to be locale aware. I would like a solution that would not require additional third-party libraries. ...
I'm using Xcode for C++ on my computer while using Visual Studio at school. The following code worked just fine in Visual Studio, but I'm having this problem when using Xcode. clock c1(2, 3, 30); Everything works just fine, but it keeps giving me this error that says "Expected ';' before 'c1'" Fine, I put the ';' .. but then, it gi...
I was wondering would I still need to use a basic game loop for this particular operation? ...
The C++ specification says the default destructor deletes all non-static members. Nevertheless, I can't manage to achieve that. I have this: class N { public: ~N() { std::cout << "Destroying object of type N"; } }; class M { public: M() { n = new N; } // ~M() { //this should happen by default // d...
For example, in language X: let x = CreateOject( "MyProgID" ) x.LateBoundCall() x.Release() // (or setting x to Nothing in VB-like language, etc) What happens to the DLL MyProgID lives in? Does COM unload DLLs automatically? EDIT This is assuming that the code above is in an executable that does not expose any COM. ...
I have a Windows C++ console program, and if I don't call ReleaseDriver() at the end of my program, some pieces of hardware enter a bad state and can't be used again without rebooting. I'd like to make sure ReleaseDriver() gets runs even if the program exits abnormally, for example if I hit Ctrl+C or close the console window. I can use ...
I am always confused about static variables, and the way memory allocation happens for them. For example: int a = 1; const int b = 2; static const int c = 3; int foo(int &arg){ arg++; return arg; } How is the memory allocated for a,b and c? What is the difference (in terms of memory) if I call foo(a), foo(b) and foo(c)? ...
Hello! I'm trying to compile a PHP extension in VS2008. It is dependent on 3 other projects which I link statically. It used to work fine when I had all my code in one .cpp file. I separated the code into several files to make it more manageable and now it won't compile. I'm getting several (~100 per file) linker errors, LNK2005 (alrea...
I'm taking a programming languages course and we're talking about the "extern C" declaration. How does this declaration work at a deeper level other than "it interfaces C and C++"? How does this affect the bindings that take place in the program as well? ...
hi . Can anybody show me an example how i get the pixel values of an Image ? I want to read an Image and iterate over it .. and print out the actual "red" value. Can anyone help ? i'm a beginner :( ...
I'm experimenting with multithreading in Windows and was wondering whether I should use Win32 API use POSIX Threads for Windows Learning Pthreads would be useful if I tried to develop such applications on different platforms - but am I losing anything by not learning Win32 API? Or are both similar enough so that learning one allows m...
We are aware of MSXML, based on COM technologies. We want to use it for a VC++ project starting soon. Are there any other XML libraries do good compared to MSXML? ...
How do I check if a computer supports SSE2 in C++, I need to do that prior installing a software that needs the support for it. Any idea? Thank you. Edit from what I understand, I came up with this : bool TestSSE2(char * szErrorMsg) { __try { __asm { xorpd xmm0, xmm0 // executing SSE2 ...
can you get the last or newly added element in std::set? for example say if the loop runs to collect the elements to fill in the std::set. if on the first run the set was, [0] "A" [1] "B" [2] "D" and, on second run, the set becomes [0] "A" [1] "B" [2] "C" [3] "D" How would you check if 'C' is the new element that was added? ...
What is actually passed in call by reference to a function? void foo(int &a,int &b) when I write foo(p,q) what is actually passed to the function. Is it the address of p and q? ...
As most C++ programmers should know, partial template specialization of free functions is disallowed. For example, the following is illegal C++: template <class T, int N> T mul(const T& x) { return x * N; } template <class T> T mul<T, 0>(const T& x) { return T(0); } // error: function template partial specialization ‘mul<T, 0>’ is not...
What is the best way to represent the following data for subsequent parallel computations: A set of quadruples (approximately 20,000,000) of integers that need to be acessible by the first three elements of a quadruple as indexes? The computation is supposed to be done with MPI in C/C++. UPD: I should also emphasize that I have two si...