c++

Revert exception specifications behavior under VC++ 9.0

Hello everyone, I'm working on old code that relies heavily on the exception specifications behavior described in the language standard. Namely, calls to std::unexpected() on exception specification violations of the form described below. foo() throw(T) { /*...*/ } Nothrow specifications are indeed guaranteed to not throw, but throw(...

C++ Debug builds broke in Snow Leopard X-Code

After upgrading to XCode 3.2 and Snow Leopard, my debug builds are broken and fail at runtime. Stringstreams do not seem to work. They work in Release mode. I've narrowed it down to a combination of GCC 4.2, OSX SDK 10.6 and the _GLIBCXX_DEBUG pre-processor symbol. These are the defaults for new XCode projects' Debug configurations. ...

Parse out Non-Alpha Numeric characters from SQLCHAR object

I currently have a bunch of SQLCHAR objects from a database query. The query results are stored in a std::string and then binded to the individual SQLCHAR variables. Some of these variables need to be parsed in order to remove any non-alphanumeric characters. What is the best approach here? I have implemented a basic parsing of a std::s...

C++ Template Specialization

The following template specialization code template<typename T1, typename T2> void spec1() { } Test case 1 template< typename T1> //compile error void spec1<int>() { } Test case 2 template< typename T2> //compile error void spec1<int>() { } generates a error C2768: 'spec1' : illegal use of explicit template arguments compil...

c++ operator overload and usage

bool operator()(Iterator it1, Iterator it2) const { return (*it1 < *it2); } Can someone explain this function for me, thanks! is this means overload the operator ()? after overload this, how to use it ? ...

How is variant_row implemented in database template library(C++)?

is there anyone have read the source code of dtl in c++? I found there is a class called variant_row, it used to store all kinds of data, and i tried to read the source code, but it is really hard for me, can someone explain how it is implemented and the class struct? Thanks ! ...

Reference to Lua function in C/C++

I have a functions nested relatively deeply in a set of tables. Is there a way in C/C++ to get a "reference" to that function and push that (and args) onto the stack when I need to use it? ...

C++ assessment tests

Does anyone know of free C++ assessment tests? I would like to practice my C++ skils before interviews. Brainbench used to have it for free; now they want $49.99 and I think it's rip off.. ...

typedef'ing an array vs. using a struct in C++

Found an interesting use of a typedef that I really didn't see the need for. typedef int Color[3]; So then the use would be: Color pants; pants[0] = 0; etc. Using the typedef through ptrs was creating strange looking code that wasn't clear. Why not just use a struct? struct Color { int r; int g; int b; }; Color pants; pants.r = ...

Automatic increment of build number in QT Creator

I would like to have a variable (or #define) in C++ source that will increment each time I use QT Creator to build source code. Is there any way I can do this, perhaps some QT Creator plugin or similar? If there is a way to do it if I use "make" on command line to build? ...

biggest datatype in c++?

Which is the biggest integer datatype in c++? ...

Getting ring 0 mode in C++ (Windows)

How I can get ring 0 operating mode for my process in Windows 7(or Vista)? ...

How is insert iterator work in c++

there is insert iterator in database template library or other library, Can someone tell me how it work ? Thanks! ...

exception problem in C++ visual studio

Hello, I have a problem in catching an exception. I am trying to re throw an exception and I get a message: "There is no source code available for the current location". The code is very simple: #include <exception> using namespace std; try { throw exception("asas"); } catch (const exception& e) { cout<< "Error msg"<< e.what()<< ...

Call Python from C++

I'm trying to call a function in a Python script from my main C++ program. The python function takes a string as the argument and returns nothing (ok.. 'None'). It works perfectly well (never thought it would be that easy..) as long as the previous call is finished before the function is called again, otherwise there is an access violat...

Memory and Register panels in Visual Studio 2008 missing

When I still had VS2005 there were a Memory and a Register panel available while debugging C/C++ projects. I think they could be activated from the Debug menu, I'm not sure anymore. The problem is that in VS2008 (Pro) I can't find them nowhere. I thought that it may be some corruption of the program files, but after installing Win7 and a...

Parse config file in C/C++

Hi, I'm a newbie looking for a fast and easy way to parse a text file in C or C++ (wxWidgets) The file will look something like this (A main category with "sub-objects") which will appear in a list box [CategoryA] [SubCat] Str1 = Test Str2 = Description [SubCat] [End] [SubCat] Str1 = Othertest ... [CategoryA] [E...

Debugging/tracing embedded sql

Is there a way to trace/log sql from the code (not from the db side, but rather what the code thinks it's doing)? I am using Pro*C/C++: Release 8.1.7.0.0 for Oracle ...

Sizeof in C++ and how to calculate pointer length?

Can someone explain the following code snippet for me? // Bind base object so we can compute offsets // currently only implemented for indexes. template<class DataObj> void BindAsBase(DataObj &rowbuf) { // Attempting to assign working_type first guarantees exception safety. working_type = DTL_TYPEID_NAME (rowbuf); working_ad...

How to get Python exception text

I want to embed python in my C++ application. I'm using Boost library - great tool. But i have one problem. If python function throws an exception, i want to catch it and print error in my application or get some detailed information like line number in python script that caused error. How can i do it? I can't find any functions to ge...