hi guys,
i have got all but one last instance.
here's my code:
void main()
{
Animal bozo("Bozo", 408, 400); // name, cagenumber, weight
cout << "This animal's name is " << bozo.getName() << endl;
bozo.destroy();
}
i've declared the class for Animal and functions like name, cageno and weight. as t...
I am writing a distributed application framework in C++. One of the requirements is the provision of distributed shared memory. Rather than write my own from scratch (and potentially re-invent the wheel), I thought I would see if there were any pre-existing Open source libraries - a quick google search did not yield anything to useful.
...
If I do something like this:
float a = 1.5f;
float b = a;
void func(float arg)
{
if (arg == 1.5f) printf("You are teh awresome!");
}
func(b);
Will the text print every time (and on every machine)?
EDIT
I mean, I'm not really sure if the value will pass through the FPU at some point even if I'm not doing any calculations, and if ...
I am currently using Codegear RAD Studio 2007. One of my company clients' decided that he would be interested in localized version of our software (to Russian - I don't know if it matters, that we won't be able to use standard windows code page). As a part of our software we are using RAVE to generate some reports.
Is there any solution...
I have an MFC application that spawns a number of different worker threads and is compiled with VS2003.
When calling CTreeCtrl::GetItemState() I'm occasionally getting a debug assertion dialog popup. I'm assuming that this is because I've passed in a handle to an invalid item but this isn't my immediate concern.
My concern is: From my ...
I'm using ant to build a mixture of Java and C++ (JNI) code that makes up a client project here. I've recently switched the C++ part of the build to using ant with cpptasks to build the C++ code instead of having ant invoke the various versions of Visual Studio that are necessary to build the code.
In order to get this to work, it is ne...
I have some complicated C++ code but the problem narrows down to doing a push_back on a list of structures:
list<cache_page> cachedPages;
void f()
{
cache_page cpage(a,b);
cachedPages.push_back(cpage);
}
I have commented all the data members of the struct cache_page and still the error persists. If I comment the push_back lin...
Hi,
I have something like that:
Class Foo : Base {.."my stuph" ..};
int main() {
Base *b = new Base;
Foo f (b); <== **error** "invalid conversion from Base to Foo."
..
}
How can I clone b to f?
In "my stuph" I have functions which make workout between Foo and Base.
I can't change Base to much while it's written by others....
To disallow copying or assigning a class it's common practice to make the copy constructor
and assignment operator private. Both Google and Qt have macros to make this easy and visible.
These macros are:
Google:
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
Qt:
#def...
I am designing a game server with scripting capabilities. The general design goes like this:
Client connects to Server,
Server initializes Client,
Server sends Client to EventManager (separate thread, uses libevent),
EventManager receives receive Event from Client socket,
Client manages what it received via callbacks.
Now the last par...
I have some code which is effectively this:
class dummie_type
{
public:
int a;
void do_stuff()
{
// blah
}
};
class dummie_type dummie[10];
void main()
{
subroutine();
}
void subroutine()
{
dummie[3].a = 27; // etc...
dummie[5].do_stuff();
}
Note that the array of classes is global, and I ne...
I'm designing a library for myself that allows the chaining of streams of data. Let me paint the scenario:
I create a SerialDatastream which is the bottom layer and reads from and writes to a COM port.
I pass a pointer to this to the constructor of a ProtocolDatastream, which interprets the bytes when read from the serial datastream (...
We're doing a small benchmark of MySQL where we want to see how it performs for our data.
Part of that test is to see how it works when multiple concurrent threads hammers the server with various queries.
The MySQL documentation (5.0) isn't really clear about multi threaded clients. I should point out that I do link against the thread ...
I am looking for an OS level API to account for cycles consumed by a specific thread in OSX.
This is similar to this question (and answer) but in OSX.
...
How to use binder2nd, bind2nd, and bind1st?
More specifically when to use them and are they necessary?
Also, I'm looking for some examples.
...
Is the following valid? Or how can I get something close to this.
template<class T_> class Template {
//something
};
class Parent {
public:
Template<Parent> variable;
Parent() : variable(this) { }
};
class Derived : public Parent {
public:
Template<Derived> variable;
Derived() : Parent() { }
}
Thanks in advance.
...
I have a predefined struct (actually several) where variables span across 32-bit word boundary. In Linux (and Windows using GCC) I am able to get my structs to pack to the correct size using 'attribute((packed))'. However I cannot get it to work the same way using VC++ and #pragma pack.
Using GCC this returns a correct size of 6 bytes...
Looking for examples on simple tree iterations in C++, both recursive and iterative. (post, pre and in-order)
...
When I debug a large app (with VS2008) that I maintain on a Windows 7 Hyper V VM, it seems that once I hit a breakpoint, VS constantly throws 0xC0000096 Privileged instruction exceptions( or 0x00000005 Access violation reading 0x03A6E7EB).
It doesn't seem to matter where the breakpoints are set either. I can do exactly the same things o...
Hi! I'm writing an application in C++ (using Eclipse with Linux GCC) that's supposed to interact with my MySQL server.
I've downloaded the MySQL Connector C++ a, precompiled, and copied the files into the directories (/usr/lib, /usr/include). I've referenced in in the GCC C++ Linker Section of the Project Properties in Eclipse ( "mysqlc...