c++

Taking the address of a pointer

If I declare the following variables: int array[10] = { 34, 43,12, 67, 34, 43,26, 98, 423,1 }; int * p = array; Then, this loop: for ( int i = 0; i < 10; i++ ) { std::cout << &*p++ << " "; } gives me different output ( a different set of addresses ), to this code: for ( int i = 0; i < 10; i++ ) { std::cout << p++ << " "; }...

-webkit-box-shadow blur with QtWebKit?

Is there any way to achieve working blur for -webkit-box-shadow at the time? Reading through the comments of this bug report, i recognized that this is still an issue, although the bug report is marked as RESOLVED FIXED since version 528 (I am using version 534.6). ...

Core dump not in sync with gdb stack trace.

I have a program which crashes due to a segmentation fault. The core file is produced. running the core in gdb gives me the following: HP gdb 6.1 for HP Itanium (32 or 64 bit) and target HP-UX 11iv2 and 11iv3. Core was generated by `gcpf1fwcApp'. Program terminated with signal 6, Aborted. I used the command thread app...

Not getting any Response from Named Pipe Server

I have created a NamedPipe inside a Windows Service and starting the Service Manually or as the System Starts up. EDIT: lpszPipename = TEXT("\\\\.\\pipe\\1stPipe"); OVERLAPPED m_OverLaped; HANDLE hEvent; hPipe=CreateNamedPipe (lpszPipename, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_...

Are Static Library Machine Independent?

Well, I am Developing a program in C++ in an Ubuntu 10.04.1 (Intel Core2Quad) LTS, but the releases are running in a Debian 5.0.5 (Intel(R) Xeon(R) CPU). Some libraries such as crypto++ or mysqlclient have different versions in both OS. So I decided to compile the binary statically with all the libraries statically compiled in the Ubuntu...

Assigning boost::iterator_range to singular range

I'm using Boost.Range to pass around some data and a container class for this data. The data is loaded in a different thread and may in some cases not be ready yet. In this case the container is initialized with the default iterator_range, hence containing singular iterators. I'm doing assignments and copying of the data containers (henc...

Build Visual Studio 6 project with Visual Studio 2010

I am trying to build a project created in VS 6 with VS 2010. When I open .dsw file, VS converts the project asking me this message: "... ProjectName.dsp must be converted to the current Visual C++ project format. After it has been converted, you will not be able to edit this project in previous versions of Visual Studio. Convert and op...

How can I use nftw(...) and define the block size for the stat function

Hi, I want to use nftw() to traverse my file system directory structure and sum up how many space each directory is using. I don't want to use du because it make fork call. I used nftw (with the flag - FTW_PHYS), nftw calls stat but i noticed that the default block size is 512bytes , while my file system use a different block size. any ...

Types of child classes

I have a question which kind of applies to all languages with static typing and some sort of OOP. If I have a class A, a class B which is a child of A, and a class C which is a child of B and a variable of the type A, can I store instances of B and C in it also? ...

Arguments for and against supporting std::wstring exclusively in cross-platform library

I'm currently developing a cross-platform C++ library which I intend to be Unicode aware. I currently have compile-time support for either std::string or std::wstring via typedefs and macros. The disadvantage with this approach is that it forces you to use macros like L("string") and to make heavy use of templates based on character type...

read arguments from variadic template

Hi all, I am a little confused about how can I read each argument from the tuple by using variadic templates. Consider this function: template<class...A> int func(A...args){ int size = sizeof...(A); .... } I call it from the main file like: func(1,10,100,1000); Now, I don't know how I have to extend the body of func to be able to...

Interesting problem on pointers..Please help

#include<iostream> #include<conio.h> using namespace std; int main() { int x = 65; int *ptr = &x; char * a= (char *)ptr; cout<<(int)*(a); getch();return 0; } Sixeof(ptr) and Sizeof(a) display 4 Sizeof(int) displays 4 and sizeof(char) displays 1 So 65 is stored in 4 byte...

Collision detection between 2 rotated cubes

Possible Duplicate: Collision detection between two general hexahedrons Right now I do collision detection by finding the min and max and doing bounding box check. Unfortunately, my player cube rotates with the camera and this makes for some annoying results when the player is at a 45 degree angle. The constraints are that eac...

Prettier syntax for "pointer to last element", std::vector?

I'm wondering if there is prettier syntax for this to get a normal pointer (not an iterator) to the last element in a C++ vector std::vector<int> vec; int* ptrToLastOne = &(*(vec.end() - 1)) ; // the other way I could see was int* ptrToLastOne2 = &vec[ vec.size()-1 ] ; But these are both not very nice looking! ...

Better variable exploring when debugging C++ code with Eclipse/CDT

Using Eclipse and CDT to debug C++ code the variable windows is cumbersome and not very informative for types defined in the standard template library or in boost (e.g. shared_ptr). Just an example how this may look like for an std::vector: bar {...} std::_Vector_base<TSample<MyTraits>, std::allocator<TSample<MyTraits> > > ...

C++ STL containers, 'under the bonnet'?

Hi, what would be the best way to learn what actually happens with the STL containers? I presume just programming wouldnt be enough. Are there any books specifically aimed at this? ...

Objective C Project using C++ POSIX Classes

Hi, I have to create a iOS Programm using Code of some C++ POSIX Classes. I already read the "Using C++ With Objective-C" manual of the Apple Developer Center. They describe how to mix C++ & Objective C code in a .mm file. My question is, is there any possibility to use the C++ Classes in my .h/.m files of a normal Objective C Project?...

When is the handle with name \GLOBAL?? is created?

Hi, I have a dump of process where the handle count in the process did reached 16 million handles (which is the maximum allowed handles per process). Hence the process got hanged. From dump (This is second dump where the handle count is high but not max limit.) I get following data : 53778 Handles Type Count None ...

Berkeley DB and C++ benchmark example?

Hi there! I'm trying to run benchmarks with a little berkeley db and c++ code, just for research purposes. Currently I'm testing with the following code. I'm filling the recors only with incrementing integers (I omitted things like error handling for better readability) (db is my own berkeley db class) // Open the database db.open( NU...

To write a fuction that prints each element of a STL vector despite the type

I tried with this piece of code but it didn't work template <class T> void display(vector<T> vec) { vector<T>::iterator MyIter; for(MyIter=vec.begin();MyIter!=vec.end();MyIter++) cout<<*MyIter<<" "; cout<<endl; } I mean if there's a way of avoid making a function for each type T (int, char, string). I'm using only builtin ...