I have a object of CCriticalSection in my class to synchronize the exceptions to a method. I use it with CSingleLock object like this:
void f()
{
try
{
CSingleLock lock(&m_synchronizer, TRUE);
.....
.....
}
catch(SomeException )
{
}
catch(...)
{
}
}
The critical section object is properly unlock...
I'm very curious of the stack memory organization after I experiment what's going on in the background and obviously saw it's matching with tiny knowledge I acquired from books. Just wanted to check if what I've understood is correct.
I have a fundamental program -- has 2 functions, first one is foo and the other is main (the entry poin...
Apologies if this has been asked before, I'm not quite sure of the terminology or how to ask the question.
I'm wondering if there are libraries or best practices for implementing object models in C++. If I have a set of classes where instances of these classes can have relations to each other and can be accessed from each other via vari...
After I thought that I've understood how they work, I tried this:
NSString *str1 = [NSString stringWithCString:"one"];
NSString *str2 = [NSString stringWithCString:"two"];
NSLog(@"str1: %x, %@", &str1, str1); //bfffd3cc, one
NSLog(@"str2: %x, %@", &str2, str2); //bfffd3c8, two
str1 = str2;
NSLog(@"str1: %x, %@", &str1, str1); //bfffd3c...
If I have a auto_ptr I can pass it for a reference?Like:
auto_ptr<MyClass>Class(new MyClass);
void SetOponent(MyClass& oponent);
//So I pass SetOponent(Class)
And what is odd copy behavior of auto_ptrs?
...
Hello,
What's the best and easiest way to build a c++ application, which was written with Visual Studio, for Linux? The code itself is ready - I used only cross-plattform libs.
Is it possible to prepare everything under Windows in Visual Studio and then build it with a cli tool under Linux? Are there any docs describing this?
Thanks,...
Hi,
I have written a program that uses qhttp to get a webpage. This works fine on Linux, but does not work on my Windows box (Vista). It appears that the qhttp done signal is never received.
The relevant code is:
Window::Window()
{
http = new QHttp(this);
connect(http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)));
url =...
Hi, do you have a working code to share.
I’m trying to figure out how to save to a file an IBitmapImage image.
I need to resize existing .jpg file and it seems like the only API for Windows Mobile. I managed to load it convert it to IImage -> IBitmapImage -> IBasicBitmapOps and resize it finally, but I have no clue how to save it pro...
Hello,
I’m looking for a code snippet that would programmatically format unallocated space on a given drive.
I’m ideally looking for .net code (VB.NET C#) or C++.
Many thanks
...
I have been a Half-Life lover for years. I have a BS in CS and have been informally programming since High-School. When I was still in college I tried to become a mod programmer for fun..using the first Half-Life engine...didn't work so good. So i figured after all my great college learrning :-) I would have more insight on how to tackle...
Although I think that I've got that now (the light bulb is pretty bright now but still flickering a little bit), I'd like to read more stuff about pointers, variables, references, memory addresses, etc. Just the whole thing, i.e. what I have to understand when hearing thre term "reference" (think it's just a pointer, not sure).
So let u...
I have two namespaces defined in the default/"root" namespace, nsA and nsB. nsA has a sub-namespace, nsA::subA. When I try referencing a function that belongs to nsB, from inside of nsA::subA, I get an error:
undefined reference to `nsA::subA::nsB::theFunctionInNsB(...)'
Any ideas?
...
Is there any easy way to view the data in an STL std::list<T> in the Metrowerks CodeWarrior debugger? I can view data near the beginning or end of the list by looking at expressions such as
instances->__list_imp.__list_deleter.end_.compressed_pair_imp.second_.prev_->data_
I can expand the little '+' signs next to the struct members t...
I'd like to pass to a function expecting a C++ object of a pure virtual class a Lua object of a class that derives from the pure virtual C++ class. How can I do this?
I'm new to lua and luabind so bear with me.
In C++:
struct A {
virtual void foo() = 0;
};
void do_something(A* a) {
a->foo();
}
In Lua:
class 'MyA' (A)
....
func...
I'm using the msxml to parse an xml file. Language is C++. The xml file contains some dates and times using the xsd:dateTime format (Something like that: 2009-04-29T12:00:00Z)
Is there an easy way to convert xsd:dateTime to something like SYSTEMTIME, FILETIME or VariantTime?
...
Duplicate of:
Making the perfect programming language
Have you ever implemented a programming language?
When is it reasonable to create my own programming language?
Creating a Mobile Programming Language
How to write a programming language ?
Learning to write a compiler
How to implement my own programming language on JVM
Can anyone d...
sqlite3_column_text returns a const unsigned char*, how do I convert this to a std::string? I've tried std::string(), but I get an error.
Code:
temp_doc.uuid = std::string(sqlite3_column_text(this->stmts.read_documents, 0));
Error:
1>.\storage_manager.cpp(109) : error C2440: '<function-style-cast>' : cannot convert from 'const unsig...
Also, is there a cross-platform way to change the attribute of a file from read-only to writeable?
Thanks much,
Bert
...
I'm trying to create a function:
template <typename T>
void doIt( T*& p )
{
if ( !p ) { return; }
T& ref = *p;
getClassName( ref );
}
where the behavior varies according to the type of p passed in. In particular, the version of getClassName called should depend upon the type of p. In the following example, I can successfully ...
Hi, all
I am new here.
I am also new on C++
So here is the class and function i wrote.But i got the compiler error
My class:
class fooPlayer
{
public:
void fooPlayerfunc(){}//doing something here
char askYesNo(std::string question);
};
class fooPlayerFactory
{
public:
virtual std::auto_ptr<fooPlayer> MakePlayerX() cons...