c++

C++ enum value initialization

I have an enum declared in my code as: enum REMOTE_CONN { REMOTE_CONN_DEFAULT = 0, REMOTE_CONN_EX_MAN = 10000, REMOTE_CONN_SD_ANNOUNCE, REMOTE_CONN_SD_IO, REMOTE_CONN_AL, REMOTE_CONN_DS }; I expect the value of REMOTE_CONN_SD_IO to be 10002, but when debugging the value of ((int)REMOTE_CONN_SD_IO) was given as ...

PRECOMPILED_HEADER and Subdirs template on Qt

Hi All, I have a big Qt project, splitted on several static libraries (around 70) and one application, and for that I'm using a .pro file with the subdirs template. To speed up the compilations time, I want to use precompiled headers and found that using the PRECOMPILED_HEADER on each sub-project does the trick, BUT, every project co...

Open source C/C++ 3d renderer (with support of 3ds max models)

Best, smallest, fastest, open source, C/C++ 3d renderer (with support of 3ds max models), better not GPL, It should support Lights, textures (better dynamic), simple objects, It should be really fast and it shall have lots of use examples ...

C++ Array Sort Me

Stuck on an array sorter. Have to sort numbers from largest to smallest. I'm trying two loops (one nested in the other). Here's the code: int counter=0; // inner counter int counter2=0; // outer counter int sparky[14]; //array set to 14 just to simplify things int holder; // holds the highest value int high; //stores the position where ...

preventing data from being freed when vector goes out of scope

Is there a way to transfer ownership of the data contained in a std::vector (pointed to by, say T*data) into another construct, preventing having "data" become a dangling pointer after the vector goes out of scope? EDIT: I DON'T WANT TO COPY THE DATA (which would be an easy but ineffective solution). Specifically, I'd like to have some...

Template Classes in C++ ... a required skill set?

I'm new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly? ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am basically looking for something to take code written by two people, and clean it up to a standardized style. Does such an app exist? Thanks a b...

Where do I get sample code in C++ creating iterator for my own container?

I have been searching for sample code creating iterator for my own container, but I haven't really found a good example. I know this been asked before (http://stackoverflow.com/questions/148540/c-creating-my-own-iterators) but didn't see any satisfactory answer with examples. I am looking for simple sample code to start how to design ...

Undefined reference

I'm getting this linker error. I know a way around it, but it's bugging me because another part of the project's linking fine and it's designed almost identically. First, I have namespace LCD. Then I have two separate files, LCDText.h and LCDGraphic.h. LCDText.h: //[snip] void TextDraw(Widget *w); void TextBarDraw(Widget *w); void T...

How to read/write data into excel 2007 in c++?

How to read/write data into excel 2007 in c++? ...

c++: generate function call tree

I want to parse current c++ files in a project and list out all the methods/functions in it and then generate the function call and caller trees. F.g. you can refer how doxygen generates the call tree. I have checked gccxml but it doesn't list the functions called from another function. Please suggest me some lightweight tools (open so...

What are the benefits to passing integral types by const ref

The question: Is there benefit to passing an integral type by const reference as opposed to simply by value. ie. void foo(const int& n); // case #1 vs void foo(int n); // case #2 The answer is clear for user defined types, case #1 avoids needless copying while ensuring the constness of the object. However in the above case, the re...

Optimal datafile format loading on a game console.

Hello. I need to load large models and other structured binary data on an older CD-based game console as efficiently as possible. What's the best way to do it? The data will be exported from a Python application. This is a pretty elaborate hobby project. Requierements: no reliance on fully standard compliant STL - i might use uSTL th...

How do I get hardware information on Linux/Unix?

How I can get hardware information from a Linux / Unix machine. Is there a set of APIs? I am trying to get information like: OS name. OS version. available network adapters. information on network adapters. all the installed software. I am looking for an application which collects this information and show it in a nice format. I ha...

conversion of unicode(16bit) data to 7bit ascii

hi all can anyone help me in converting the data from unicode(16bit) to 7bit ascii in c++ language thanx ...

Does using callbacks in C++ increase coupling?

Q1. Why are callback functions used? Q2. Are callbacks evil? Fun for those who know, for others a nightmare. Q3. Any alternative to callback? ...

How to use the PI constant in C++

I want to use the PI constant and trigonometric functions in some C++ program. I get the trigonometric functions with include <math.h>. However, there doesn't seem to be a definition for PI in this header file. How can I get PI without defining it manually? ...

question about the size of memory allocated by new operation

well, I'm reading Thinking in C++ and I'm confused by new operator. Here below is the code from the book: //: C13:ArrayOperatorNew.cpp // Operator new for arrays #include <new> // Size_t definition #include <fstream> using namespace std; ofstream trace("ArrayOperatorNew.out"); class Widget { enum { sz = 10 }; int i[sz]; ...

WebBrowser control from ATL to c#

Hi, In ATL if I create webbrowser control using IWebBrowser2, it works great in Windows Mobile. I am able to visit all sites, progress bar comes, everything is fine.. rest of UI content I can't do in ATL, since it's time consuming. I would like to go for c#. can any one suggest me how to make ATL activex control and use it in c#. Thank...

Is it correct to use declaration only for empty private constructors in C++?

For example is this correct: class C { private: C(); C(const & C other); } or you should rather provide definition(s): class C { private: C() {}; C(const & C other) {}; } ? Thanks for the current answers. Let's extend this question - does compiler generate better code in one of this examples? I can im...