c++

Array of zero length

I am working on refactoring some old code and have found few structs containing zero length arrays (below). Warnings depressed by pragma, of course, but I've failed to create by "new" structures containing such structures (error 2233). Array 'byData' used as pointer, but why not to use pointer instead? or array of length 1? And of course...

Passing an array using COM?

I am a COM object written in ATL that is used from a C++ application, and I want to pass an array of BYTEs between the two. My experience of COM/IDL so far is limited to passing simple types (BSTRs, LONGs, etc.). Is there a relatively easy way to have the COM object pass an array to the caller? For example, I want to pass a raw image ...

C++ mark as deprecated

Hi. I have a method in an interface that I want to deprecate with portable C++. When I Googled for this all I got was a Microsoft specific solution. (http://msdn.microsoft.com/en-us/library/c8xdzzhh(VS.80).aspx and http://msdn.microsoft.com/en-us/library/044swk7y(VS.80).aspx) A second prize solution would be to ifdef a MSVC and a GCC so...

What are the practical differences between C compilers on Windows?

A program written in Visual C/C++ 2005/2008 might not compile with another compiler such as GNU C/C++ or vice-versa. For example when trying to reuse code, which uses windows.h, written for a particular compiler with another, what are the differences to be aware of? Is there any information about how to produce code which is compatible ...

What is the fastest way to get the 4 least significant bits in a byte (C++)?

I'm talking about this: If we have the letter 'A' which is 77 in decimal and 4D in Hex. I am looking for the fastest way to get D. I thought about two ways: Given x is a byte. x << 4; x >> 4 x %= 16 Any other ways? Which one is faster? Thanks. ...

T4 Templates - suitable for generating C++ code?

Are there any issues which might make MS's T4 Template code-generation system unsuitable for generating C++ code? ...

Wrapping boost::signal to C# delegates

Hi, say I have an asynchronous library, written in native C++, with an interface similar to this: class connection { public: boost::signal< void() > sig_connection_made; boost::signal< void(const std::string&) > sig_error; void connect(const std::string& host, const std::string& port); }; that I want to wrap in C#. Does ...

MS Web Browser on Pocket PC

Hi all, I'm trying to create a custom web browser for on a pocket pc in C++ MFC. When I add the Microsoft Web Browser activeX control and run the app on the pocket pc (emulator) then this error pops up: "Debug assertion failed. occcont.cpp line: 916" When I look in the debug window of VS2005: "CoCreateInstance of OLE control {8856F961-...

Is there any 'out-of-the-box' 2D/3D plotting library for C++?

Hello all, I looked at the different options for plotting functions (or other types of graphs) in an interactive window. I mostly use wxWidgets but I'd be open to any other "interfaces". Looking at what is available, here is what I've found: wxPlot: Not updated since 2006. But it would be a good candidate if it was... wxMathPlot: Ve...

Recommended C++ Database Abstraction Layers

What Database Abstraction Layer libraries would you recommend for use with C++? I am more interested in solutions for non-Windows platforms, but that is personal preference. Which libraries would you recommend and why? ...

How to make an ATL COM class derived from a base class?

The "ATL simple object" wizard doesn't provide a way to specify that a new class is derived from an existing coclass and its interface. In Visual Studio 2008, how do I make a new ATL COM class derived from an existing one (i.e. Base implements IBase, and I want to make a new Derived class derived from Base that implements IDerived, where...

Open source library to convert DOC and other MS-Office files to image(s)

Can you recommend an open source library (C or C++) to convert MS Office files into a set of images? I am evaluating ImageMagick and while it does support PDF files, it does not work with MS Office files. ...

How to Check if File is ASCII or Binary in C++

So using the system command file we can use file to determine if a file is ASCII Text or "data". I wanted to know if there is a way to check in code which one it was? I want to basically throw a corrupt error if the file is 'data'. I am using ifstream for reading the files. Thanks for any help! Duplicate of this question. ...

Defining macros in Visual Studio - /D or #define?

Recently, when porting some STL code to VS2008 I wanted to disable warnings generated by std::copy by defining the new _SCL_SECURE_NO_WARNINGS flag. You can do this in two ways: Using the /D compiler switch, which can be specified in the project properties. You need to ensure it is defined for both Release and Debug builds, which I of...

Build solution for C++

I'd like to setup a build server for unmanaged C++ code developed in Visual Studio 2005. The build server should be able to do the following: Monitor a Subversion repository for code changes and schedule a build Checkout code from Subversion and run unit tests Provide some sort of report on build success and changes from previous build...

C++0x Attributes you'd like to see

Recently voted into the C++0x working paper was an attribute syntax. This syntax provides a way to specify other pieces of information to the compiler. The Committee Draft also includes several standard attributes. The syntax is to wrap the attribute list in double square brackets, e.g. [[noreturn]]. These attributes can be "namespaced"...

MFC, c++ When showing and hiding ctrls on the screen can I disable paint for a bit.

I have a screen with say 20 controls on it. I want to show all twenty, then hide only the ones that don't relate to what I'm working on. psudoCode. for each element show element for each element in hide list hide element. My problem is that between the loops the screen paints. It looks very ugly. I know I've seen this do...

Is there a graphical test runner for "Google Test" ( gtest ) for windows?

Seems a great C++ unit testing framework. I'm just wanting something a bit more sophisticated than the console output for running the test, also something that makes it really easy to run specific tests (since gtest supports all kinds of test filtering) If there is nothing, I'll probably roll my own ...

how do i use python libraries in C++?

I want to use the nltk libraries in c++. Is there a glue language/mechanism I can use to do this? Reason: I havent done any serious programming in c++ for a while and want to revise NLP concepts at the same time. Thanks ...

What should I keep in mind when porting from C to C++

What should I keep in mind when converting my projects from C to C++? Is there any reason to use C at all? The only thing in my mind now is to make sure it's friendly to DLLs so I can create a C interface if I need it. Note: I know C++ just fine. Templates, partial specialization, why multiple inheritance is bad (I've only seen one prop...