c++

catching exceptions in Javascript thrown from ActiveX control written in C++

I've written an ActiveX control in C++ that throws (C++) exceptions out when error conditions occur within the control. The Javascript code that invokes the object representing an instance of the control is surrounded by a try - catch block: try { var controlInstance = window.controlInstance; ... perform operations on controlIn...

How do I learn Visual C++?

I'm interested in learning how to program using Microsoft's Visual C++ for Windows. In particular, I want to know how to make applications for the Windows platform. I'm already a professional programmer. I know the C and C++ languages as well as many other languages in depth, I just haven't done any Windows programming before, so I don'...

C++ common interface for "cin" and "File"

Is there a common interface for cin and file input? I want to make a program that has an optional parameter prog [input-file] If an input file is specified, then it should read from the file, and if not, it should read from cin. From what I can tell, they both implement istream. How would you set up it so that I could do something l...

is the MSVC++2010 debugger limited?

hello, i'm trying to check what's in my set in the debugger, i have 170 objects in it but i can only see 99 of them, is the debugger limited? he can show only 99 objects? can i see all the objects? thanks. ...

How to write portable C/C++ program?

Possible Duplicate: Writing a portable C program - which things to consider? Could you give me some suggestions/useful links/books Could you tell me some successful portable C/C++ project that's open source Do you have any idea on writing portable GUI program? QT is the best choice except Java? ...

gcc, include file dependencies

hello Is there option (or some utility) to generate graph of dependencies for given file? I am trying to track down who brings an include file into compilation unit. ...

alternative solutions to this programming problem? all languages welcome

Create a method that: Given a string, look for a mirror image (backwards) string at both the beginning and end of the given string. In other words, zero or more characters at the very beginning of the given string, and at the very end of the string in reverse order (possibly overlapping). For example, the string "abXYZba" has the mirror...

compiling crash - using a member function within another member function

Hi, I am attempting a simple time display program in C++. Edited #include <iostream> #include <cstdlib> #include <iomanip> #include <string> using namespace std; class vClock { public: // constructor vClock(int = 0, int = 0); // mutable member functions void set_time(int, int); void time...

Testing C/C++ source code

Possible Duplicates: Suggestion for UnitTest tools for C++ Choosing a C++ unit testing tool/framework Unit Testing C Code This is something I've been wondering now that we have to use C/C++ as base language for some of our university projects : In Java there's JUnit, In PHP there's PHPUnit etc. How are unit testing don...

Boost C++ Libraries: Unit Test Assertion on % Processor Usage

I'm writing a unit test with Boost.Unit, and the code I'm testing must not exceed 50% of a single CPU during a portion of the unit test. How could I make this assertion from within the source code? ...

Boost C++ Libraries: Unit Test Assertion on Deadlocks

I'm writing a unit test with Boost.Unit, and I would like to include basic tests for deadlocks in the code I'm testing. My first idea was to set a deadline timer in one thread while running the test in another that is expected to finish well before the deadline. When the timer goes off, assert that the thread is not running or not interr...

const and static specifiers in c++

#include<iostream> using namespace std; class A { private: const int a=9; public: void display() { cout<<a; } }; int main() { A a; a.display(); return 0; } Why does initialization const int a=9 is not permitted. ...

How to get Screen coordinates from a 3D Point? Opengl

Hi, I've seen alot of Screen-Coordinate to world coordinate posts, but have not seen the opposite. Is there an easy way of getting screen coordinates from a 3d point, from any angle I view it from? I'm using C++ and opengl ...

Erase-remove idiom with std::set failing with constness-related error

Can someone help me out here? Compiling this code: void test() { std::set<int> test; test.insert(42); test.erase(std::remove(test.begin(), test.end(), 30), test.end()); // <- Line 33 } Is generating the following error when compiling: $ make g++ -c -Wall -pedantic-errors -Wextra -Wunused -Werror a_star.cpp /usr/lib/gcc/i686-p...

Template doubt in C++

#include <iostream> using namespace std; template<typename T> void test() { cout << "Called from template T"; } template<int I> void test() { cout << "Called from int"; } int main() { test<int()>(); } In the above snippet test<int()>() calls the first version and gives output Called fro...

How to convert this code to use string

char * recursivecombo(char *str, int choices, int level) { int len = strlen(str); level++; if( level == choices) { for (int i = 0; i < len -2; i++) { printf("%c", str[i]) ; } } else { for (int i = 0; i < len - 2; i++) { ...

Simple Operator question. +=

So my friend gave me some source code to start out with so I could review and understand it and I have a question about it, but since he's not online I thought I would try here, mainly I don't quite understand this line. num += i; Essentially, this is the same as num = num + i right? If you need more details please tell me! I l...

directx tutorials c++

im searching for full directx tutorials i found directxtutorial.com but it only gave me the basic. couldn't find others that were full tutorials. have you find any or know any? ...

Eliminating temporaries in operator overloading

Note: as noted by sellibitze I am not up-to-date on rvalues references, therefore the methods I propose contain mistakes, read his anwser to understand which. I was reading one of Linus' rant yesterday and there is (somewhere) a rant against operator overloading. The complaint it seems is that if you have an object of type S then: S a...

What gets converted to what when comparing a double to an integer for identity?

OK, so I know you're generally not supposed to compare two floating-point numbers for equality. However, in William Kahan's How Futile are Mindless Assessments of Roundoff in Floating-Point Computation? he shows the following code (pseudo-code, I believe): Real Function T(Real z) : T := exp(z) ; ... rounded, ...