c++

What's the difference between C++0x concepts and The Boost Concept Check Library (BCCL)?

Concepts didn't make the C++0x standard, but Boost still provides The Boost Concept Check Library (BCCL). I guess that BCCL doesn't cover everything that was meant to into the C++0x standard. What is the difference between BCCL and the proposed C++0x solution? ...

could someone explain these C++ code snippets for me

#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif Why define these tags ? CSortHeaderCtrl::CSortHeaderCtrl() : m_iSortColumn( -1 ) , m_bSortAscending( TRUE ) { } What is the two functions after colon used for ? BEGIN_MESSAGE_MAP(CSortHeaderCtrl, CHeaderCtrl) //{{AFX_MSG_MAP(...

Preprocessor examples in C language

I want some examples of C preprocessor directives, such as: #define pi 3.14 #define MAX 100 I know only this. I want to know more than this, more about preprocessor directives. ...

Naming convention for a variable that works like a constant

I have a variable that I'm using like a constant (it will never change). I can't declare it as a constant because the value gets added at runtime. Would you capitalize the variable name to help yourself understand that data's meaning? Or would you not because this defies convention and make things more confusing? The larger question: ...

Using COM object from C++ that in C#.NET returns object []

I have a COM object that I'm trying to use from C++ (not .NET), and all of the example programs and manual are written assuming the use of C#.NET or VB.NET. COM is new to me so I'm a bit overwhelmed. I'm using #import on the TLB but am struggling to deal with the variants that are used as parameters. I have one particular method, that ac...

A few WMI problems

Hi guys! I have two questions: How would I use the WMI to determine the type of hard drive present on the computer? I'm currently using the Win32_DiskDrive Class, and calling the InterfaceType property, however, it reports SATA hard drives as IDE. Is there any way of correctly determining the type of hard drive present? I am trying...

Problem creating static/dynamic c++ libraries in visual studio

When I try to build my c++ library (in both static and dynamic mode) using visual studio 2008, in the debug folder, instead of .lib or .dll file, some .obj files are created along with an .idb and an .pdb file. how can I make visual studio build the library file? ...

How to set sockets to blocking mode in Windows?

I'm doing some fairly simple cross-platform TCP socket programming. I have unfortunately found out that when compiled on Windows, my sockets are non-blocking by default, while on OS X they are blocking by default. How do I force a socket into blocking mode on Windows? Do they normally default to non-blocking mode or is something terribly...

Subclassing a window with a functor (Win32)

Quick sanity check: Is it possible to subclass a window using a functor? I'm running into a situation where I want to have some data available in the win proc, but GWLP_USERDATA is already being used. A functor seems like a good alternative, but I'm having trouble getting it to work. Here's the basics: class MyWinProc { // Win Proc Fun...

What's the easiest way to call Postgres from a MinGW program?

All I need is get MinGW talking to Postgres. I've considered several options: Use libpq. The libpq.lib that comes with Postgres for Windows links okay, but crashes when I use the library. I think because it was compiled for VC++. I can't find just the libpq code, so I'd have to recompile the entire Postgres tree in MinGW. Not easy...

How to unblock ConnectNamedPipe and ReadFile? [C#]

I have a class (NamedPipeManager) which has a thread (PipeThread) that waits for a NamedPipe connection using (ConnectNamedPipe) and then reads (ReadFile) - these are blocking calls (not-overlapped) - however there comes a point when I want to unblock them - for example when the calling class tries to stop the NamedPipeManager... How ca...

Autocorrelation returns random results with mic input (using a high pass filter)

Hello, Sorry to ask a similar question to the one i asked before (FFT Problem (Returns random results)), but i've looked up pitch detection and autocorrelation and have found some code for pitch detection using autocorrelation. Im trying to do pitch detection of a users singing. Problem is, it keeps returning random results. I've got s...

"l-value required" error

When do we get "l-value required" error...while compiling C++ program???(i am using VC++ ) ...

Var-Args: Last named parameter not function or array?

This question is about vararg functions, and the last named parameter of them, before the ellipsis: void f(Type paramN, ...) { va_list ap; va_start(ap, paramN); va_end(ap); } I was reading in the C Standard, and found the following restriction for the va_start macro: The parameter parmN is the identifier of the rightmost para...

The right way to create pointer to pointer object?

Hi stackers! What is the right way to create a pointer to pointer object? Like for example, int **foo; foo = new int[4][4]; Then the compiler gives me an error saying "cannot convert from int (*)[4] to int **. Thanks. ...

What are the different processor registers used by the VS C++ compiler?

What are the different registers used by the C++ compiler in a program? What is the difference between SP and FP? If possible please point me to some detailed reference docs. Curious to know the underlying things happening in a compiler. Is it possible to view these registers during the execution of a program in Visual Studio. Appreciate...

Standard Property Dialog/Browser for ActiveX - Control

I am looking for a property browser/editor for generic activeX controls. It must work for controls that just expose an IDispatch interface, no proeprty pages of their own. Best would be something that comes with the OS (like the "All properties" property page VC6 used). It is only for testing, so comfort is not important, modal propert...

How do I refer to std::sin(const valarray<double> &) ?

I'm having trouble with some valarray function pointer code: double (*fp)(double) = sin; valarray<double> (*fp)(const valarray<double> &) = sin; The first compiles, the second gives: error: no matches converting function 'sin' to type 'class std::valarray<double> (*)(const class std::valarray<double>&)' ...

haXe - Generating Exe's (cpp)

Hello, I've been instructed to download and install FlashDevelop and it seems fine but I don't know how to generate exe files when writing programs in haXe. I try to Build or Run the project in FlashDevelop BUT it just doesn't do anything. Can anybody please advise me on how to do this? Thank you ...

C++ template, linking error

I have a problem in calling a template class I have. I declared a new type name Array, which is a template; In the .hpp file: template <typename T> class Array { public: Array(); }; In the .cpp file: template <typename T> Array<T>::Array() { //Do something } In main: Array<int> arr; I get Linkage error: unresolved external s...