I'm used to thinking of all initialization of globals/static-class-members as happening before the first line of main(). But I recently read somewhere that the standard allows initialization to happen later to "assist with dynamic loading of modules." I could see this being true when dynamic linking: I wouldn't expect a global initialize...
One thing I always shy away from is 3d graphics programming, so I've decided to take on a project working with 3d graphics for a learning experience. I would like to do this project in Linux.
I want to write a simple 3d CAD type program. Something that will allow the user to manipulate objects in 3d space. What is the best environment ...
From cplusplus.com:
template < class Key, class Compare = less<Key>,
class Allocator = allocator<Key> > class set;
"Compare: Comparison class: A class that takes two arguments of the same type as the container elements and returns a bool. The expression comp(a,b), where comp is an object of this comparison class and a and b are...
class Action {
public:
void operator() () const;
}
class Data {
public:
Data();
~Data();
Register(Action action) { _a = action; }
private:
Action _a;
}
class Display {
public:
Display(Data d) { d.Register( bind(Display::SomeTask, this, _1) ); }
~Display();
void...
Hi All,
We are migrating our software system developed in C++, MFC, ATL/COM (VS 2008 IDE) from WinXP to Windows Vista. Can anybody please provide any reference material that details information on the possible code issues that could arise during the migration? I found one at the DDJ site
http://www.ddj.com/windows/199001130;jsessionid=...
I was hoping you guys could help me flush this idea out. I want to create Sets. And I think i want to construct them like so. Have a vector of pointers like this:
vector<char*> sets;
Where the user will enter in a single letter to represent the name of the set, 'A' for instance. But then I would like 'A' to point to another contain...
You often hear that C++ is preferable to Objective-C for games, especially in a resource-constrained environment like the iPhone. (I know you still need some Objective-C to initially talk to iPhone services.) Yet, the 2D game engine of choice these days seems to be Cocos2d, which is Objective-C.
I understand that what Apple calls "Obje...
Hey guys,
I've compiled my code on two different machines, which I thought had identical setups. However, one compiles without issues, and the other gives the following error.
LogEventReader.cpp(320) : error C3861: 'for_each': identifier not found, even with argument-dependent lookup
The relevant code:
#include <algorithm>
...
for_...
I think that I understand the difference between Release and Debug build modes. The main differences being that in Debug mode, the executable produced isn't optimized (as this could make debugging harder) and the debug symbols are included.
While building PCRE, one of the external dependencies for WinMerge, I noticed a build mode that ...
I'm working on some C++ code for an embedded system. The I/O interface the code uses requires that the size of each message (in bytes) is a power of two. Right now, the code does something like this (in several places):
#pragma pack(1)
struct Message
{
struct internal_
{
unsigned long member1;
unsigned long member2;
...
Consider:
template <typename T>
class Base
{
public:
static const bool ZEROFILL = true;
static const bool NO_ZEROFILL = false;
}
template <typename T>
class Derived : public Base<T>
{
public:
Derived( bool initZero = NO_ZEROFILL ); // NO_ZEROFILL is not visible
~Derived();
}
I can't compile...
#include <iostream>
using namespace std;
int main()
{
int array[2];
array[0] = 1;
array[1] = 2;
array[3] = 3;
array[4] = 4;
cout << array[3] << endl;
cout << array[4] << endl;
return 0;
}
When I compile and run this program, I am not getting any error (no error during compile and during runtime).It simp...
Is there a way to call a webservice from C++ code (gcc - not MS)?
...
I'm not familiar with Qt or with Google Native Client. Is it possible for a TRIVIAL Qt console application to be ported to Google Native Client? I understand that some work would be involved. But the question is, how much if it's even possible?
...
Hey guys another quick question here that got me thinking.
In generating windows dll dynamic libraries, you are asked declare which functions should be exported so that some functions maybe left private to the dll and not accessible by other applications.
I haven't seen anything mentioned regarding whether destructors need to be export...
I'm trying to make changes to some legacy code. I need to fill a char[] ext with a file extension gotten using filename.Right(3). Problem is that I don't know how to convert from a CStringT to a char[].
There has to be a really easy solution that I'm just not realizing...
TIA.
...
I know this is probably a very subjective question, but I just want to start with the one which is the easiest and fastest to learn, so that I can get started with a small project of mine as fast as possible, it's a a little 2D game, to start with at least.. Which one would you recommend me to go with? And I'm using C++
...
I know the question is not very descriptive but I couldn't phrase it better.
I'm trying to compile a static linked library that has several objects, all the objects contain the following:
#include foo.h
foo.h is something along these lines:
#pragma once
template<class T>
class DataT{
private:
T m_v;
public:
D...
Hello everyone.
Rather simple question.
Where should I store error,exception, user messages?
By far, I always declared local strings inside the function where it is going to be invoked and did not bother.
e.g.
SomeClass::function1(...)
{
std::string str1("message1");
std::string str2("message2");
std::string str3("message3");
...
// so...
Consider the following contrived example:
void HandleThat() { ... }
void HandleThis()
{
if (That) return HandleThat();
...
}
This code works just fine, and I'm fairly sure it's spec-valid, but I (perhaps on my own) consider this unusual style, since the call appears to return the result of the function, despite the fact that ...