Hi everyone,
today i found out that the compiled static library i'm working on is much larger in Release mode than in Debug. I found it very surprising, since most of the time the exact opposite happens (as far as i can tell).
The size in debug mode is slightly over 3 MB (its a fairly large project), but in release it goes up to 6,5 MB...
I was under the impression that std::tr1::array was the same as the boost::array in that it would throw an exception when accessing an index out of bounds. In fact, I took a peek in the header and it appears that way as well. Could someone explain why the following code results in a bus error (gcc version 4.0.1 (Apple Inc. build 5465)) ...
Please let me know if you encounter any good programming (C/C++/Datastructures) video tutorials. This is something I found which has quite a good compilation http://freescienceonline.blogspot.com/2007/09/programming-language-video-lectures.html
~ Sam (The more I give the more I receive)
...
I have an Observer class and a Subscriber class.
For testing purposes, the observer creates a thread that generates fake messages and calls CServerCommandObserver::NotifySubscribers(), which looks like this:
void CServerCommandObserver::NotifySubscribers(const Command cmd, void const * const pData)
{
// Executed in worker thread //
...
I don't want to look stupid, but how should I link libxml2 to my g++ project (Linux environment)? What should I add to my code besides #include <libxml/tree.h>? Thanks for a link or a quick hint!
ps. I added this to my CXXFLAGS: xml2-config —cflags --libs. Enough?
...
Hi all, I'm having a problem when trying to compile these two classes (Army and General) in their own header files:
#ifndef ARMY_H
#define ARMY_H
#include "definitions.h"
#include "UnitBase.h"
#include "UnitList.h"
#include "General.h"
class Army
{
public:
Army(UnitList& list);
~Army(void);
UnitBase& operator[](con...
Hi! I'm trying to code a widget that utilizes HGE functionality. So I have subclassed from QWidget and overloaded paintEvent(). It works OK but troubles appear when I try to handle input. Events are handled only when mouse enters zone 2(link text) But I need to handle input in zone 1(where HGE is rendering). What should I do?
...
Is there any function or method to randomly choose a number (or 2 numbers or more) from an array?
...
Given an MSI product code I want to get the upgrade code (among other properties) from an already installed product. I have tried this by calling the MsiOpenProduct method, followed by MsiGetProductProperty(). An (abbreviated) example looks like this:
MSIHANDLE handle = NULL;
MsiOpenProduct(strProductCode,&handle);
CString strUpgradeCod...
Coming from a C background, I've always assumed the POD types (eg ints) were never automatically zero-initialized in C++, but it seems this was plain wrong!
My understanding is that only 'naked' non-static POD values don't get zero-filled, as shown in the code snippet. Have I got it right, and are there any other important cases that I'...
I need tutorials and help for my project about fake detection currency
...
I'm trying to create a model to store data about photos, icons and pathnames.
class PhotoListItemModel : public QAbstractItemModel {
struct ItemModelType {
std::string fileName;
QImage image;
boost::shared_ptr<char> unique_id;
};
std::map<string, ItemModelType> ItemMap;
std::map<char*, stri...
I'm attempting to manually load the hexdump of an elf file that I compiled using g++ into a processor simulation I designed. There are 30 sections to a standard elf file and I am loading all 30 segments with their proper memory location offset taken into account. I then start my program counter at the beginning of the .text section (0040...
Using fprintf, what is the format-string to output two digits after a decimal separator?
float number = 3.0;
fprintf(pFile, "%10.02f", number);
This always outputs 3 instead of 3.00
How do I fill up the digits after decimal separator with zeros? I want 3.00 written in the output file.
...
Hi Guys , Well i have a probleme with some puzzles , However i want to solve this puzzle and i need your help , i have an array from ten Numbers(Or More),for example :
arr[1,2,3,4,5,6,7,8,9,10]
i want a method to check if 3 numbers from this arrays have the same sum to another 3 numbers (I want to get all the possibilities ! ) , for ...
Could a variable of Data be used as a map key?
struct Data {
Data(int X, int Y) {x=X; y=Y;}
int x; int y;
}
int main()
{
std::map<Data, int> map_;
map_.insert(std::make_pair(Data(1,2), 0)); //error inserting
}
...
I've got some example code for controlling a wifi module that tells me to use VC 6.0, and that newer versions aren't supported. I'm trying to get it work, anyway. It uses CString, which is part of MFC, so I've downloaded a trial of Visual Studio 2010 to see if I can get it to compile.
Here's the code that's throwing the (start of the) er...
Hi,
I have an abstract class vertex which represents an n-tuple. The element of the vertex can be of any type: ie, the vertice's components could be of type int, int, float or something. Because the vertex can have an arbitrary number of dimensions, I was thinking of making the class have a component setter like so:
class vertex {
...
What does boost::thread do if it fails to create the thread?
The winAPI returns a NULL (I guess posix does something similar) but as thread is an object how do I test to see if the thread was created?
...
Hi,
I'm writing a game, and I saw the FPS algorithm doesn't work correctly (when he have to calculate more, he sleeps longer...) So, the question is very simple: how to calculate the sleeptime for having correct FPS?
I know how long it took to update the game one frame in microseconds and of course the FPS I want to reach.
I'm searchi...