c++

Simple assembly questions

; int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) _wWinMain@16 proc near var_4= dword ptr -4 hInstance= dword ptr 4 hPrevInstance= dword ptr 8 lpCmdLine= dword ptr 0Ch nShowCmd= dword ptr 10h From what I can see, the last 4 variables are the parameters passed to the WinMain func...

C++ Self Assessment - Online

I am an experienced C++ programmer, but I see there are many gaps in my understanding. I would like to know what are my strong areas and the ones I am weak at. This will help me to choose the topics I want to further concentrate. Is anybody aware of any such service (paid or free) which is reliable available online? ...

How to pass an integer as command line argument in turbo c++

I am unable to pass integer value through the command line in turbo c++. Please help me. ...

Overriding "new" and Logging data about the caller

I'm trying to write a memory profiler and so far have been able to get my custom functions to work for malloc, free, new and delete. I tried using __FILE__ and __LINE__ to log the originator inside the overloaded new method, but (as expected) it just gives the details of where the overloaded function is. Is there a way to get the details...

Access boost::function arguments

Is it possible to access the arguments contained in a boost::function type? I'd like to be able to retrieve the address of the function to be called, and the values of the arguments provided for that function. ...

manipulating LARGE_INTEGERS

I am converting some code from C to C++ in MS dev studio under win32. In the old code I was doing some high speed timings using QueryPerformanceCounter() and did a few manipulations on the __int64 values obtained, in particular a minus and a divide. But now under C++ I am forced to use LARGE_INTEGER because that's what QueryPerformanceCo...

Arrays inside structs in C

Hello everyone. I´m struggling to understand this concept: I have a fixed size definition: (from http://msdn.microsoft.com/pt-br/library/aa931918.aspx) typedef struct _FlashRegion { REGION_TYPE regionType; DWORD dwStartPhysBlock; DWORD dwNumPhysBlocks; DWORD dwNumLogicalBlocks; DWORD dwSectorsPerBlock; DWORD dwBytesPerBloc...

error using restrict keyword

In the following example: void foo (double *ptr) { const double * restrict const restr_ptr=ptr; } I get this error: error: expected a ";" const double * restrict const restr_ptr=ptr; ^ I compile with -std=c99, using gcc 3.4 Any Ideas? ...

In c++ what does a tilde "~" before a function name signify?

template <class T> class Stack { public: Stack(int = 10) ; ~Stack() { delete [] stackPtr ; } //<--- What does the "~" signify? int push(const T&); int pop(T&) ; int isEmpty()const { return top == -1 ; } int isFull() const { return top == size - 1 ; } private: int size ; int top ; T* sta...

What is exactly the base pointer and stack pointer? To what do they point?

Using this example coming from wikipedia, in which DrawSquare() calls DrawLine(), could anyone explain me what the ebp and esp are in this context? From what I see, I'd say the stack pointer points always to the top of the stack, and the base pointer to the beggining of the the current function? Or what? Thanks edit: I mean this in...

What's the -complete- list of kinds of automatic type conversions a C++ compiler will do for a function argument?

Given a C++ function f(X x) where x is a variable of type X, and a variable y of type Y, what are all the automatic/implicit conversions the C++ compiler will perform on y so that the statement "f(y);" is legal code (no errors, no warnings)? For example: Pass Derived& to function taking Base& - ok Pass Base& to function Derived& - not ...

Should const functionality be expanded?

EDIT: this question could probably use a more apropos title. Feel free to suggest one in the comments. In using C++ with a large class set I once came upon a situation where const became a hassle, not because of its functionality, but because it's got a very simplistic definition. Its applicability to an integer or string is obvious, ...

boost::bind accessors?

Suppose I have the following code: int f(int, int); int main() { SomeFunc(boost::bind(f, 1, 2)); } From the SomeFunc() function, is it possible to access the arguments held by the bound type? Something like this (pseudo code): // Obvious syntax issues... void SomeFunc(boost::bind& functor) { if(functor.function == &f) {...

use gtk_signal_connect with a member function in c++

What's the best way to connect a GTK+ signal to a non-static member function? I have a GUI class in c++ that uses gtk, and i want do something like this: Gui::Gui () { gtk_signal_connect(GTK_OBJECT(somObject), "clicked", GTK_SIGNAL_FUNC( &(this->ClickHandler) ), NULL); } ...

C++: Status and control pattern

I'm writing a C++ background/server application for Linux/Windows. Is there a standard control/profiling/reporting service I should use to expose my application's current status in a standardized way? If not, what's a good pattern (or library) to use for exposing this kind of data and control? Specifically, I want to expose the follow...

Defining a variable inside c++ inline assembly

Let's say we have the following c++ code: int var1; __asm { mov var1, 2; } Now, what I'd like to know is if I didn't want to define var1 outside the __asm directive, what would I have to do to put it inside it. Is it even possible? Thanks ...

OleInitialize fails when Common Lanuage Runtime is enabled?

I am working on a wxWidgets console application that I want to call into = a C# DLL from, via the CLR. Unfortunately, the application hiccups in the wxWidgets application initialization code because OleInitialize is failing. The error I'm seeing is a pop-up simply stating "Cannot initialize OLE." It seems that this problem is usually ...

Qt + OpenCV + eclipse (on windows)

can anyone please help me with a tutorial for integrating Qt and OpenCV on eclipse IDE? (windows). Qt works just fine, OpenCV works just fine, but together - no good.. I'm losing my mind here.. Thanks! ...

What does the "|" in "int style = SWT.APPLICATION_MODAL | SWT.OK;" do (and how to Google it)?

I can't search for | in Google. If you had found it in a software source code that you are trying to interpret, you didn't know what it does and you couldn't ask other people for help, how would you find out what it does? ...

Build Boost-powered solution in VS

Boost rocks, it is great and extremely powerful, but I hate it everytime I build solution in my Visual Studio 7.1. It seems Boost has impact on build time (not positive). I cannot remove all Boost usage from my project to compare build times but I tried it on small projects and the difference is meaningful. I guess the problem is tha...