c++

Creating a simple VS2008 visualizer inside autoexp.dat (problem with casting).

I have a large project of mixed C/C++. I've created a simple visualizer for the ICU UnicodeString class as follows... [inside autoexp.dat] icu_4_2::UnicodeString { preview ([$c.fUnion.fFields.fArray,su]) } ...and that works fine. Inside the debugger wherever I see the object I now see the text inside in the preview line. ...

C++ xml-rpc client with utf-8 support for windows

Is there any XML-RPC client for windows for C++ with UTF-8 support? I looked at XMLRPC++, but it doesn't support any encoding. ...

Building a python module and linking it against a MacOSX framework

I'm trying to build a Python extension on MacOSX 10.6 and to link it against several frameworks (i386 only). I made a setup.py file, using distutils and the Extension object. I order to link against my frameworks, my LDFLAGS env var should look like : LDFLAGS = -lc -arch i386 -framework fwk1 -framework fwk2 As I did not find any 'fra...

Implement SSL with SSPI: How to start?

Hi, I want to implement an SSL client using SSPI. Where can I find step-by-step guides, code examples, etc.? Thanks in advance. ...

Splitting Code into Headers/Source files

I took the following code from the examples page on Asio class tcp_connection : public boost::enable_shared_from_this<tcp_connection> { public: typedef boost::shared_ptr<tcp_connection> pointer; static pointer create(boost::asio::io_service& io_service) { return pointer(new tcp_connection(io_service)); } tcp::socket&...

Checking the sizeof an integer type in the preprocessor

Possible Duplicate: Why cant I use sizeof in a preprocessor condition ? How can I check the size of an unsigned in the preprocessor under g++? sizeof is out of the question since it is not defined when during preprocessing. ...

Using the sftp protocol with libcurl -- How do I list the contents of a directory?

Hi guys, I have a little doubt. I need to get a list of the files inside a specific directory on a SFTP server. I will use CUROPT_DIRLISTONLY in order to get just the names, but I'm not sure how to get them. This is the peace of code I have by now: string baseUrl(serverAddr + "/" + __destDir); curl_easy_setopt(anEasyHandle, CURLO...

Problems with passing an anonymous temporary function-object to a templatized constructor.

I am trying to attach a function-object to be called on destruction of a templatized class. However, I can not seem to be able to pass the function-object as a temporary. The warning I get is (if the comment the line xi.data = 5;): warning C4930: 'X<T> xi2(writer (__cdecl *)(void))': prototyped function not called (was a variab...

Code reading: where can I read great, modern, and well-documented C++ code?

Reading code is one of the best ways to learn new idioms, tricks, and techniques. Sadly it's very common to find badly written C++ code. Some use C++ as if it was C, others as if it was Java, some just shoot in their feet. I believe gtkmm is a good example of C++ design, but a binding could not be the best code to read (you need to kn...

ICU add custom character set detection

Hi everybody, Does somebody know how ICU Charset Detector's data is built. And is it difficult to add additional languages? For example, I saw in the bug tracker that a ticket for the detection of Thai is opened since 2007 but nothing new until today. Thanks ...

Cross platform millisecond timer lasting more than 49 days?

Hey guys, I'm going to be developing a small dedicated server in C/C++ that will require uptime of forever. I've been looking into some time functions as millisecond timing is required for calculations. I have 2 problems that I'm facing: Using a 32bit integer to store the number of milliseconds since the operation began will wrap ar...

QLocale, what is the scope of the global QLocale::setDefault()?

Problem: I have a QT based multiplatform (win,mac,*nix) application that parses ascii files containing decimal numbers. parsing is done using a variety of different code pieces that use anything from qt string stuff, c++ stdin, oldstyle scanf, etc. ascii files have always the '.' (dot) as separated decimal (e.g. in the file to be par...

how to cout a vector of structs (that's a class member, using extraction operator)

hi, i'm trying to simply cout the elements of a vector using an overloaded extraction operator. the vector contians Point, which is just a struct containing two doubles. the vector is a private member of a class called Polygon, so heres my Point.h #ifndef POINT_H #define POINT_H #include <iostream> #include <string> #include <sstream> s...

Handling macro redefinition without modifying .h files ... C / C++ language

Background: Let assume that I have two header files a.h and b.h. a.h contains: #define VAR 1 b.h contains: #define VAR 2 Note: The name of both of the macro is same. Let say I have some file myFile.c which includes both of the header files i.e. a.h and b.h. When I try to access VAR, I get a redefinition error of VAR. In order t...

Object oriented design suggestion

Here is my code: class Soldier { public: Soldier(const string &name, const Gun &gun); string getName(); private: Gun gun; string name; }; class Gun { public: void fire(); void load(int bullets); int getBullets(); private: int bullets; } I need to call all the member functions of Gun over a Soldier object. Some...

Qt variable re-assignment

I have two examples I have a question about. Let me explain via some code: Question 1: QStringList qsl(); // Create a list and store something in it qsl << "foo"; QString test = "this is a test"; qsl = test.split(" ", QString::SkipEmptyParts); // Memory Leak? What happens when I re-assign the qsl variable what happens to "foo" and ...

Getting SIGILL in float to fixed conversion

I'm receiving a SIGILL after running the following code. I can't really figure what's wrong with it. The target platform is ARM, and I'm trying to port a known library (in which this code is contained) void convertFloatToFixed(float nX, float nY, unsigned int &nFixed) { short sx = (short) (nX * 32); short sy = (short) (nY * 32...

How do I know if a function has been inlined or not ?

If I mark any function as inline, is there a way I can know if the function gets inlined or not? ...

Passing array of pointers to another class

Hi, I am trying to do the following: in main.cpp: // Create an array of pointers to Block objects Block *blk[64]; for (i=0; i<8; i++) { for (j=0; j<8; j++) { int x_low = i*80; int y_low = j*45; blk[j*8+i] = new Block(30, x_low+40.0f, y_low+7.5f, &b); } } And then I am trying to pass it to the graphics object I have cr...

Fastest algorithm for primality test

I need to test primality on intervals between numbers which are really big (in the range of long long), so i need some fast algorithm for checking if a number is prime or not. Please suggest your ideas. ...