I hope the title is describing the problem, i'll change it if anyone has a better idea.
I'm storing information in a struct like this:
struct AnyStruct
{
AnyStruct() :
testInt(20),
testDouble(100.01),
testBool1(true),
testBool2(false),
testBool3(true),
testChar('x') {}
int testIn...
I am using some Qt code that adds a VERIFY macro that looks something like this:
#define VERIFY(cond) \
{ \
bool ok = cond; \
Q_ASSERT(ok); \
}
The code can then use it whilst being certain the condition is actually evaluated, e.g.:
Q_ASSERT(callSomeFunction()); // callSomeFunction not evaluated in release builds!
VERIFY(call...
It's easy to create a new name for a type, a variable or a namespace. But how do I assign a new name to a function? For example, I want to use the name holler for printf. #define is obvious... any other way?
Solutions:
#define holler printf
void (*p)() = fn; //function pointer
void (&r)() = fn; //function reference
inline void g(){ f(...
A system has up to 100 VC++ projects, each spitting out a DLL or EXE. In addition there are many COM components with IDL and generated .h/.c files.
What's 'the right way' or at least a good way to organise this with Doxygen? One overall doxy project or one per project/solution? And what's the right way to handle COM, which has generated...
Based upon this question How to declarate LARGE_INTEGER in C# with answer of:
[StructLayout(LayoutKind.Absolute, Size=8)]
struct LARGE_INTEGER
{
[FieldOffset(0)]public Int64 QuadPart;
[FieldOffset(0)]public UInt32 LowPart;
[FieldOffset(4)]public Int32 HighPart;
}
Is my assumption below for declaring ULARGE_INTEGER correct?...
How to place a QTextEdit with left and right margins in a QVBoxLayout? I could use, of course, a QHBoxLayout, place the QTextEdit into that horizontal layout in between to spacings (addSpacing(40)) and only then the horizontal layout could add into the vertical layout, but want to know if there is a direct way of doing that.
...
Hi,
I am using Qt 4.5 so do C++. I have a class like this
class CClass1
{
private:
struct stModelDetails
{
QString name;
QString code;
..... // only variables and no functions over here
};
QList<st...
I checked out a post similar to this but the linkage was different the issue was never resolved. The problem with mine is that for some reason the linker is expecting there to be a definition for the base class, but the base class is just a interface. Below is the error in it's entirety
c:\users\numerical25\desktop\intro todirectx\godfi...
If I have an Object class named, what's the difference between create an instance just like that:
Object var;
and:
Object* var = new Object();
?
...
Consider a situation. We have some specific C++ compiler, a specific set of compiler settings and a specific C++ program.
We compile that specific programs with that compiler and those settings two times, doing a "clean compile" each time.
Should the machine code emitted be the same (I don't mean timestamps and other bells and whistles...
I currently have some python code I'd like to port to C++ as it's currently slower than I'd like it to be. Problem is that I'm using a dictionary in it where the key is a tuple consisting of an object and a string (e.g. (obj, "word")). How on earth do I write something similar in C++? Maybe my algorithm is horrendous and there is some wa...
Hello, is there any way to convert a time_t to a string with the format YYYY-MM-DD HH:MM:SS automatically, keeping the code portable?
...
(This question should probably be answered with a reference to Stroustrup.)
It seems extremely useful to be able to request a pointer to the most derived class, as in the following:
class Base { ... };
class DerivedA { ... };
class DerivedB { ... };
class Processor
{
public:
void Do(Base* b) {...}
void Do(DerivedA* d) {...}
voi...
Hello,
I have created a program that write video stream to a named pipe on windows, using Visual Studio C++ 2008 . how to be sequre that no one exept programms on this computer can acsess this pipe?
npipe = CreateNamedPipe("\\\\.\\pipe\\TestChannel", PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES , 1024...
I've spent hours with no luck on this. In terms of cmd prompt, what does the white filled in square with a 1 followed afterwards mean? e.g.
http://i1012.photobucket.com/albums/af249/dororoj/square1.jpg
I've tried using string.find() (using C++) with various hex symbols listed on the ascii table at:
http://web.cs.mun.ca/~michael/c/asci...
I am trying to address this issues because I can not seem to find a good resource online that does so.
I do not fully understand the issue cause I never got it resolved so I will try to describe it as best as possible.
Awhile ago I had an issue where headers were being ignored because "They were called once already and therefore when ...
I want to play with constexpr, does any compiler support it yet?
...
I created a VC++ console project with Visual Studio and it auto-generated this function:
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { ... }
I was just wondering what envp stands for and how/when I can/should use it?
Thank you!
...
hello,
I'm trying to port a Windows app to Linux. This appplication marks some functions with the __stdcall attribute. However, i was told by a friend that stdcall is used only on windows and has no meaning in linux (but DOES exist in Windows GCC).
I tried to search Google about that, and got some results state that there IS stdacll in L...
#include <iostream>
using namespace std;
extern int i;
int main()
{
i=10;
cout<<"the value of i is"<<i<<endl;
}
...