I'm implementing a lecture-capture project for a local university. Multiple video streams will arrive at one PC: the presenter's desktop slides, a video camera image of the presenter himself and optionally a digital whiteboard capture. These incoming streams will be managed by a desktop application that displays, transcodes/mixes and eve...
Hello,
I'm writing some code with boost asio, using asynchronous tcp connections. I've to admit that I have some doubts about it. All these regard concurrency. Here are some:
What happens if I start two or more async_write on the same socket without waiting completion of the first one? Will the handlers (and the async_write) overlap o...
In section 3.6.1.2 of both C++ Standard 1998 and 2003 editions,
An implementation shall not predefine the main function. This function shall not be overloaded. It shall
have a return type of type int, but otherwise its type is implementation-defined.
I am not a native English speaker.I do not sure what does"but otherwise" means.W...
I have this tool in which a single log-like file is written to by several processes.
What I want to achieve is to have the file truncated when it is first opened, and then have all writes done at the end by the several processes that have it open.
All writes are systematically flushed and mutex-protected so that I don't get jumbled outp...
I understand the problem with just killing the thread directly (via AfxEndThread or other means), and I've seen the examples using CEvent objects to signal the thread and then having the thread clean itself up. The problem I have is that using CEvent to signal the thread seems to require a loop where you check to see if the thread is sig...
I would like to check the type of a superclass A against the type of a subclass B (with a method inside the superclass A, so that B will inherit it).
Here's what I thought did the trick (that is, the use of forward declaration):
#include <iostream>
#include <typeinfo>
using namespace std;
class B;
class A {
public:
int i_;
...
I think I have an advanced knowledge of C++, and I'd like to learn C.
There are a lot of resources to help people going from C to C++, but I've not found anything useful to do the opposite of that.
Specifically:
Are there widely used general purpose libraries every C programmer should know about (like boost for C++) ?
What are the m...
I'm doing post graduation in computer science. In the second semester I wish to do a game in C or C++ so that I can apply my knowledge in these languages and this will add to my existing knowledge about these languages. Please suggest to me a good topic and a brief description about it. I have one of my classmates with me to do the proje...
I have a callback mechanism, the classes involved are:
class App
{
void onEvent(const MyEvent& event);
void onEvent(const MyOtherEvent& event);
Connector connect;
}
class Connector
{
template <class T> void Subscribe(boost::function <void (const T&)> callback);
}
App::App()
{
connect.Subscribe<MyEvent>(&App::OnEv...
When you are programming in a language that allows you to use automatic allocation for very large objects, when and how do you worry about stack size? Are there any rules of thumb for reasoning about stack size?
...
I've got some kind of debug-prints in boost using application. When something comes to 80th port I see "Somebody's knoking", and few other string showing the process of query analysis. So, on string
std::string std_st = std::string(std::istreambuf_iterator<char>(&_inbuffer),
std::istreambuf_iterator<cha...
Assuming that a project has been using the C class prefix for a long time, and it would be a waste of time to change at a late stage, and that the person who originally wrote the style guide has been hit by a bus, and that there are no structs in the code already...
It's a pretty trivial question, but if a C++ code style guide says "use...
std::string s("??<");
std::cout << s << std::endl;
Why does that output { instead of ??<
I'm using Visual Studio 2008. I'm assume it's encoding it but why and what is the encoding called if that is what's happening?
This little %#$^*! caused me to look for a bug in my (unit test) code for 30 minutes before I figured out my string wa...
I'm trying to understand my options for calling a C# library implementation from unmanaged C++.
My top level module is an unmanaged C++ COM/ATL dll. I would like to integrate functionality of an existing managed C# dll. I have, and can recompile the source for both libraries.
I understand from reading articles like this overview on MSD...
Hello,
does anybody know any commonly used library for C++ that provides methods for encoding and decoding numbers from base 10 to base 32 and viceversa?
Thanks,
Stefano
...
I had a frustrating problem recently that boiled down to a very simple coding mistake. Consider the following code:
#include <iostream>
class Base
{
public:
void func() { std::cout << "BASE" << std::endl; }
};
class Derived : public Base
{
public:
virtual void func() { std::cout << "DERIVED" << std::endl; }
};
int main(int a...
Possible Duplicate:
Defensive programming
We had a great discussion this morning about the subject of defensive programming. We had a code review where a pointer was passed in and was not checked if it was valid.
Some people felt that only a check for null pointer was needed. I questioned whether it could be checked at a high...
Hello all,
My friends and I are working on a compiler design as a project in my university (Damascus University).
We're using (Flex, C++, Bison, Qt) to do the job.
I was wondering if there is a way to design an IDE to our compiler using Qt. I know how to do the job but I'm asking to find out if there is some resource to start with, or...
I am currently writing a very lightweight program so I have to use C++ since it is not bound to .NET framework which drastically increases size of the program.
I need to be able to terminate process and to do that I need to get a process handle. Unfortuanately I haven't figured how to do that yet.
P.S. I know that to kill a process yo...
Is there a simple/small framework (Other than .NET) which allows you to create windowed applications with C++ under Win32. Just like a little DLL I can include with my app.
It should have basic functions like creating a window , buttons , text edits and handling them.
...