c++

Interlocked*64 on WinXP 32bit

How should I implement these 64-bit interlocked functions on WinXP? Of course I can use full mutex, but I think it's needlessly heavyweight for this task. There must be some better way. ...

C++ multiple inheritance off identically named operator

hello Is it possible to inherit identically named operator which only differ in return type, from two different abstract classes. If so, them: what is the syntax for implementing operators what is the syntax for using/resolving operators what is the overhead in general case, same as for any other virtual function? if you can provide...

Writing data chunks while processing - is there a convergence value due to hardware constraints ?

Hi, I'm processing data from a harddisk from one large file (processing is fast and not a lot of overhead) and then have to write the results back (hundreds of thousands of files). I started writing the results straight away in files, one at a time, which was the slowest option. I figured it gets a lot faster if I build a vector of a c...

Daemon writing output to file twice instead of once in C++.

I've written a daemon that writes the word "Beat" to a file, followed up the current date and time at 15 second intervals. However, each time I check the output file, the daemon appears to be outputting twice like this: Beat: Fri Jan 1 18:09:01 2010 Beat: Fri Jan 1 18:09:01 2010 where it should only have on entry. the entire...

Using C++, how do I correctly inherit from the same base class twice?

This is our ideal inheritance hierarchy: class Foobar; class FoobarClient : Foobar; class FoobarServer : Foobar; class WindowsFoobar : Foobar; class UnixFoobar : Foobar; class WindowsFoobarClient : WindowsFoobar, FoobarClient; class WindowsFoobarServer : WindowsFoobar, FoobarServer; class UnixFoobarClient : UnixFoobar, FoobarClie...

boost::function run-time performance

I'm in the process of implementing a platform independent wrapper for dynamically loaded libraries. Of course when I load functions from the libraries I need to store them as pointers for future use. I thought of using boost::function's for that instead of normal function pointers. Sure, that will increase compile time, but that's not wh...

Is it better to use `#ifdef` or inheritance for cross-compiling?

To follow from my previous question about virtual and multiple inheritance (in a cross platform scenario) - after reading some answers, it has occurred to me that I could simplify my model by keeping the server and client classes, and replacing the platform specific classes with #ifdefs (which is what I was going to do originally). Will...

CPP | .h files (C++)

Hi All, I was just wondering what the difference between .cpp and .h files is? What would I use a h file for and what would I use a cpp file for? I'm sorry if this is a really dumb question. thank you bael. ...

c++ Syntax of a constructor's initialization list with a data member struct?

Possible Duplicate: Member initialization of a data structures members EDIT: I typed the title in last, and it gave me a lsit of related problems, as it usually does. At the bottom of this list was the exact same problem. (Using the exact same code ;)). http://stackoverflow.com/questions/1480430/member-initialization-of-a-data-...

C++ Dialog box With timer

Hi, I couldn't find a simple tutorial on how to make a dialog box with decrementing timer. I don't need the timer to be accurate or actually reflect my program's inner timer. ...

Compiling Festival on MingW32

I'm trying to compile Festival on MingW32, so I can have a Windows binary. I couldn't find the Windows binary on their site. Anyone have one they can post? If not, here's what I have so far. I did the ./configure and make for it and have the following message: $ make config/config:43: ../speech_tools/config/config: No such file or ...

Win32 files locked for reading: how to find out who's locking them

In C++ (specifically on Visual C++), sometimes you cannot open a file because another executable has it opened and is not sharing it for reads. If I try to open such a file, how can I programatically find out who's locking the file? ...

Problem with Atomic operations on a intel XScale(ARM) processor - XScale-IXP42x Family - c++

We are facing a possible problem on ARM processor machine. We have done an implementation for smart pointers,which involves atomic operation for keeping track of the references. We are getting crashes for that. Is there a possible problem with atomic operations on ARM processor? ...

general boost asio stream reads question

I'm a little confused about how reading data into a stream works in asio. My main questions are: What happens if there are multiple asynchronous writes from one computer going on at the same time, and only one asynchronous read on the receiving computer. Over a TCP protocol, is there any chance that the data will get interleaved? How ...

memory overhead of pointers in c/c++

I'm on a 64bit platform, so all memory adrs are 8 bytes. So to get an estimate of the memory usage of an array, should I add 8 bytes to the sizeof(DATATYPE) for each entry in the array. Example: short unsigned int *ary = new short unsigned int[1000000]; //length 1mio //sizeof(short unsinged int) = 2bytes //sizeof(short unsinged int*)...

Different outputs

Possible Duplicate: C++ pre/post increment expression evaluation #include<iostream> using namespace std; int main() { int a=5; b=a++*++a; //(A) gives 36 cout<<(a++*++a); //(B) gives 35 return 0; } Why expressions marked as (A) and (B) gives different outputs? ...

how to convert a hexadecimal string to a corresponding integer in c++?

i have a unicode mapping stored in a file. like this line below with tab delimited. a 0B85 0 0B85 second column is a unicode character. i want to convert that to 0x0B85 which is to be stored in int variable. how to do it? ...

Protecting a program from unauthorised use/"crackers"

I am writing a piece of software in C++ which is targeted at a market in which software is traditionally heavily cracked (or at least, attempted to be). I realise that nothing can be completely protected, however I feel that trying would be a good idea and also I think some of the specifics of the situation that I'm in might be helpful. ...

Two 'main' functions in C/C++

Can i write a program in C or in C++ with two main functions? ...

stuck at defining static pointer and using it

hey there I stuck at defining a static pointer inside one of my class which is pointing to another class here is the schema of what I've done : #busineslogic.h class BussinesLogic { private : static Samenamespace::otherclass_DataLogic::clsDL *DL; }; #busineslogic.cpp samenamespace { businessnamespace{ clsBL{ Samenamespace::bu...