c++

Portable wchar_t in C++

Is there a portable wchar_t in C++? On Windows, its 2 bytes. On everything else is 4 bytes. I would like to use wstring in my application, but this will cause problems if I decide down the line to port it. ...

What are some good C++ resources for effectively using Apache XML Security?

I'm looking for some resources that allow me to understand how to use this library, particularly for signing XML. Most of what I found out there is Java related, and I would prefer to get documentation/FAQs/tutorials on the C++ library. ...

How to use msxml with Visual Studio 2008 Express (no ATL classes) without becoming crazy?

It is not really a question because I have already found a solution. It took me a lot of time, that's why I want to explain it here. Msxml is based on COM so it is not really easy to use in C++ even when you have helpful classes to deal with memory allocation issues. But writing a new XML parser would be much more difficult so I wanted ...

Upgrading to SQL Server 2005: Cannot INSERT QNAN into float column?

Background: I'm working on migrating from SQL Server 2000 to SQL Server 2005. This is providing DB service for a C++ application that uses SQL Native Client to communicate with SQL Server via ODBC. Problem: I'm attempting to insert QNAN into a float column in the database. In my application, this value is stored as a double (value: 1....

Partial Specialization Question

I need a fresh pair of eyes. This is obviously illegal, but it shows what I'm trying to do: template <typename T, T> struct Foo { }; template <typename T> struct Foo <T, 0> //Obviously I can't do this. { }; Is there any way to wrap T or do something tricky so that this sort of thing can work? Thanks! ...

Compiler Error when adding dll reference to managed c++ project

Hello, I am using VS 2008 and get compiler errors sporadically when adding a dll reference to a managed c++ file in my C++ project. I am trying to add a reference to the dll so as to be able to use smart pointers. ex: #import items.tlb The problem is that the compiler crashes at sporadic places inside of items.tlh almost as though chun...

Parse contents of array C++

I have this Code: cout << "Your Value is: "; for ( int x = nStart + 1; x < sBuffer.length(); x++ ) { if ( sBuffer[ x ] == ',' ) { nStart = x; break; } cout << sBuffer[ x ]; } // setprecision doesnt work right when...

Which language/platform to develop desktop application based on following criteria

Hi, Faced with the challenge of a new application with which you had free reign to design, assemble a team to develop and manage: Which language/platform would you choose? Why? Background: The desktop application will control a hardware device and perform computations, analyze and display the data returned by it. Requirements: (i...

How do you treat handles in C++/CLI?

I know I'm not asking this quite right, either. Please help me better form my question. I'm having a bit of a hard time getting my mind wrapped around handles -- in some ways, it looks like pointers. But unlike pointers, it seems like I can assign values directly to the handle variable, and it affects the underlying data value, not t...

Would you hire a C /Java programmer for a C++ role?

If you have a position where C++ experience is essential, would you consider someone who has little C++ experience but is experienced in both C and Java? ...

Class method and variable with same name, compile error in C++ not in Java?

class Test { bool isVal() const { return isVal; } private: bool isVal; }; On Compiling this file it says testClass.cpp:9: declaration of `bool Test::isVal' testClass.cpp:3: conflicts with previous declaration `bool Test::isVal()' Although the same would work for java class Test { ...

Why can't we use "this" inside the class?

E,g class Test { public: void setVal(const std::string& str) { this.isVal = str; //This will error out } private: string isVal; }; ...

Advantages of const in C++?

What are the advantages of const in C++ (and C) for the uninitiated? exact duplicate of http://stackoverflow.com/questions/455518/how-many-and-which-are-the-uses-of-const-in-c I beg to differ - while there are uses for const, the discussion is why use it. The question specified would be an interesting and substantive link, though. ...

IE BHO - Bypass Printer Dialog

I'm writing an add-on to bypass the printer confirmation dialog in C++. I can successfully intercept a print call, however when I try to print the document, the dialog still comes up. I'm catching the event in: STDMETHOD(Exec)(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut) and sendi...

How to restructure this code hierarchy (relating to the Law of Demeter)

I've got a game engine where I'm splitting off the physics simulation from the game object functionality. So I've got a pure virtual class for a physical body class Body from which I'll be deriving various implementations of a physics simulation. My game object class then looks like class GameObject { public: // ... private: B...

Newbie question about manual memory management and deep copying

Alright, so I'm trying out C++ for the first time, as it looks like I'll have to use it for an upcoming course in college. I have a couple years of programming under my belt, but not much in the non-garbage-collected world. I have a class, a Node for use in a doubly linked list. So basically it has a value and two pointers to other Node...

Using the "Very Sleepy" profiler to profile DLLs..

I have a DLL that I want to profile.. I tried to use Very Sleepy, but I can't seem to get the source file column to display which source file the functions came from, all it displays is "unknown".. Anyway, I'm really baffled on how to use this app.. Can anyone point me to some help? There's not much documentation on it and it seems like...

"Inherit not, contain" or "inherit, not contain"

I have an application which spawns a lot of child objects and each of them works with some global application objects e.g. registers itself in the global application registry, updates application statistics etc. How should application transfer the ability to access those global objects to the children? Should every child inherit from st...

Warning C4099: type name first seen using 'class' now seen using 'struct' (MS VS 2k8)

Is this warning anything to worry about? I've read that it can cause erratic behaviour? It's an example I'm trying to compile, could someone explain to me why the author declares the object as a class but then typedef's it to a structure? Is it perfectly normal to do so if the class is POD? Thanks. ...

get C++ object name in run time

Can I get object's name in run time (like getting object's type via RTTI)? I want the object to be able to print its name. Thanks. ...