c++

Windows API and GetClassName()? Another name?

I have some code that has a dynamic-class system in C++ that has a member called GetClassName(), a rather harmless name one would imagine. However when included in a large project with Windows headers all hell broke loose. Apparently Windows uses a #define GetClassName (GetClassNameA or GetClassNameW) which screws up everything, and my v...

Avoiding dynamic_cast/RTTI

I was recently working on a piece of C++ code for a side project (the cpp-markdown library, for the curious), and ran into a coding question that I'd like some opinions on. cpp-markdown has a base class called Token, which has a number of subclasses. Two of the main subclasses are Container (which holds collections of other Tokens) and ...

Making an OS in C++

What kind of C++(Restate to programming) would I have to learn to make my own OS kernel? (I know I would also have to learn assembly.) EDIT*Like interrupts , keyboard driver, getting input.* Ok everyone I made a really * 3 basic OS and would like to share it. Here you go. http://bcsy.hostzi.com/BytOS.zip Compile on linux ...

Setting up a mock interface in C++

Hi.. I'm currently trying to use a certain SDK that has me loading functions off a DLL that a vendor provides.. I have to pass arguments to these functions and the DLL does all the work.. Now, the DLL is supposed to be communicating with another device, while I just wait for the results. However, I don't have this device, so how do I s...

Posix Threads in c++

How to implement posix threads in linux c++.The smme program when saved as ".c and run using c compiler is ok. but in c++ it is giving error .. I think i made mistake when compiling is there any tag to be included like "-lpthread" for c++ Can someone pls send a valid code...? Actually this is my code int cooperbussman :: startlis...

How to generate a compiler warning/error when object sliced

Hello, Gurus, I want to know if it is possible to let compiler issue a warning/error for code as following: Note: 1. Yea, it is bad programming style and we should avoid such cases - but we are dealing with legacy code and hope compiler can help identify such cases for us.) 2. I prefer a compiler option (VC++) to disable or enable ob...

What Visual Studio 2008 productivity features are missing from C++ Express edition?

I'm using Visual Studio C++ 2008 Express to learn a native API for a new project. What I'm wondering is: what productivity features present in the full version that you take for granted are missing from Visual Studio Express? I'm not referring to large "paid" features like MFC support - I'm thinking of small features (sometimes provided...

socket programming in client

I wrote this program in C++ and on Linux platform. I wrote a client and server socket program. In that client program, I wrote socket function and immediately after that I am doing some other actions not at all depending on socket (I wrote 2 for loops for some other logic). After that I prepared the structures required for the socket ...

Dynamic array... copy constructor, destructor, overloaded assignment operator

Hi, I am studying for my midterm exam. There is going to be a question about setting up an array dynamically, and maybe doing a copy constructor, a destructor and overloading the assignment operator. Can you please verify if I am correct. Also I don't understand what overloading the assignment operator means. Can you help me out with ...

Fighting fragmentation in custom memory manager

Hi, I've written a c/c++ memory manager for heap allocations (overloaded new/delete and malloc/realloc/free, based on Doug Lea's malloc but designed to be wait free) and seem to be having some trouble with fragmentation. Are there any good resources out there that detail good strategies for avoiding fragmentation via the manager? Pleas...

Different arguments in the Constructor of a class in C++

Can I have a constructor work in different ways if the argument is of different type? i.e. int or float. Let's say that if I do, new Object(3) the constructor fills an array with 3 at every index Let's say that if I do, new Object(3.5) the constructor fills an array with index+3.5 for every index Let's say that if I do, new Object() ...

Identifying primitive types in templates

Hello I am looking for a way to identify primitives types in a template class definition. I mean, having this class : template<class T> class A{ void doWork(){ if(T isPrimitiveType()) doSomething(); else doSomethingElse(); } private: T *t; }; Is there is any way to "implement" isPrimitiveType(). ...

VS2005 C++ broken vtables

Hi, I'm currently working on a quite big (and old, sigh) code base, recently upgraded to VS2005 (SP1). Me and my team are changing/updating/replacing modules in this code as we go but we have occasionally been running into problems where the vtables seems broken. I am no expert on vtables but these sure seems to be broken. The errors ma...

sqlite prepared statements - how to debug

I'm writing some c++ code that uses the sqlite3 library. I'm using a prepared statement to which I bind a variable at runtime. How do I examine the SQL query in the statement after the bindings? For example, the code below doesn't return a row. When using a premade string and sqlite3_exec, I get the results I expect. sqlite3_stmt *sta...

Can I use blocks to manage scope of variables in C++?

Hi, I'm trying to gain some memory saving in a C++ program and I want to know if I can use blocks as a scope for variables (as in Perl). Let's say I have a huge object that performs some computations and gives a result, does it makes sense to do: InputType input; ResultType result; { // Block of code MyHugeObject mho; resu...

How to use IGlobalInterfaceTable to pass an interface pointer?

Without: MFC ATL Question: What are the steps involved, to use IGlobalInterfaceTable, when passing a particular interface pointer to several threads using CreateThread? ...

How do I check if a user has local admin privileges in win32

How do I check if a user has local admin privileges in win32 from c++ ...

How to best write out a std::vector < std::string > container to a HDF5 dataset?

Given a vector of strings, what is the best way to write them out to a HDF5 dataset? At the moment I'm doing something like the following: const unsigned int MaxStrLength = 512; struct TempContainer { char string[MaxStrLength]; }; void writeVector (hid_t group, std::vector<std::string> const & v) { // // Firstly...

C# form in a C++ program

Hello. In my last question I asked about running a C# form in a C++ program. I got it working, but I am having problems. I will try to be brief. My C++ program must execute a C# form and execute some simple functions in it (increasing counters and showing them). However I do not know the best way to do this. I have the form initialized ...

Videos about C++ programming?

Do you have these kinds of video like those listed below.It better to learn from experts talk.So we don't learn it the wrong way Advanced Topics in Programming Languages Series: C++ Threads Text Processing with Boost Concepts Extending C++ Templates For Generic Programming ...