I have a function getSlope which takes as parameters 4 doubles and returns another double calculated using this given parameters in the following way:
double QSweep::getSlope(double a, double b, double c, double d){
double slope;
slope=(d-b)/(c-a);
return slope;
}
The problem is that when calling this function with arguments for examp...
On a customer machine (WinXP SP2) to which I have no access, I have a Win32 EXE (unmanaged C++) that crashes on startup. I guess the best way to troubleshoot this is to obtain a (mini-)dump and analyze it later with windbg or similar.
Now, I would normally tell the customer to install Debugging Tools for Windows and run
cscript adplus....
I want to create a C++ Builder DLL project that doesn't use VCL. But I get this error in sysmac. Does anyone know the possible cause of this error?
...
Hello,
Is there a simple way to convert a bitmask in to an array index?
ie. If i've got an enum
a = 0x01,
b = 0x02,
c = 0x04,
d = 0x08,
e = 0x10,
etc
and I want to store releated data in an array, is there a simple way such that i can convert a to 0, b to 1, c to 2. etc?
Many thanks
...
Playing around with MSVC++ 2005, I noticed that if the same class is defined several times, the program still happily links, even at the highest warning level. I find it surprising, how comes this is not an error?
module_a.cpp:
#include <iostream>
struct Foo {
const char * Bar() { return "MODULE_A"; }
};
void TestA() { std::cout << "...
In my project I found a piece of code in which a method was getting called in constructor's initializer list.
Test2(Test* pTest):m_pTest(pTest), m_nDuplicateID(pTest->getTestID())
{
}
I observed that there is a chance that the users of Test2 might pass NULL to the constructor. Since the pointer is used without validation ther...
I have this class in which at some point I am computing a array of two doubles:
double* QSweep::computeIntersection(double m1, double b1, double m2, double b2){
double* v=new double[2];
v[0]= (b2-b1)/(m1-m2);
v[1]= (m1*b2-m2*b1)/(m1-m2);
return v;
}
In another function of the class I am using this array to work with its values.
Depe...
Hi, I'm learning DCOM and I need to debug a class that I have created, how can I do this?
...
I've been looking at the example C++ Factory method pattern in Wikipedia http://en.wikipedia.org/wiki/Factory_method_pattern
and have a couple of questions:
1) Since the factory method is static, does that mean the newly created object won't go out of scope and have the destructor method called when the factory method exits?
2) Why re...
I currently try to implement some interprocess communication using the Windows CreateFileMapping mechanism. I know that I need to create a file mapping object with CreateFileMapping first and then create a pointer to the actual data with MapViewOfFile. The example then puts data into the mapfile by using CopyMemory.
In my application I ...
I'm a blitz++ newbie. So far, so good, but I'm a bit mystified why the commented out line in the code below fails to compile with
error: conversion from ‘blitz::_bz_tinyMatExpr<blitz::_bz_tinyMatrixMatrixProduct<double, double, 3, 3, 3, 3, 1, 3, 1> >’ to non-scalar type ‘const m33’ requested
I'm on Debian/Lenny (g++ 4.3.2, Blitz 0.9...
Hi all
I hit this issue about two years ago when I first implemented our SWIG bindings. As soon as we exposed a large amount of code we got to the point where SWIG would output C++ files so large the compiler could not handle them. The only way I could get around the issue was to split up the interfaces into multiple modules and to co...
I was thinking that when a function returns an object on the stack to the calling function, the calling function gets a copy of the original object but the original object's destructor is called as soon as the stack unwinds. But in the following program, the destructor is getting called only once. I expected it to be called twice.
#incl...
Hi There,
If get a gring from the registry and it correctly displays when I place it in a message box.
::MessageBoxW(0, (LPCWSTR)achValue, _T("Found"), MB_YESNO);
The value is stored in archValue which is a DWORD. What I want to do is compare it to the following string "2.0.7045.0" but strcmp fails to work for me.
Any ideas on how to d...
Hello all
im looking for cross platform GUI for free for commercial project
( that means i can't give the code ) no GPL and i guess no LGPL
what else its leaving me ? wxWidgets ?
Thanks
...
Use case:
class B {
int b;
public:
int getB() {
return b;
}
};
class A {
B *b;
public:
int getB() {
if (b ) { //How can I avoid the null check for b here
return b->getB();
}
}
}
...
Hello Everyone,
I've created a COM object using ATL. I want to create a new object that can be returned from a method, and passed in as a parameter. I've created the coclass, but I can't figure out how to add a method that will accept it as a parameter.
The error I'm getting is MIDL2025: syntax error: expecting a type specification nea...
What is the relation between word length, character size, integer size, and byte in C++?
...
I have an string array filled with words from a sentence.
words[0] = "the"
words[1] = "dog"
words[2] = "jumped"
words[3] = "over"
words[4] = "the"
words[5] = "wall."
words[6] = "the"
words[7] = "cat"
words[8] = "fell"
words[9] = "off"
words[10] = "the"
words[10] = "house."
etc.
(Stupid example, but it works for this)
Each word will be ...
I'm creating a design document for a security subsystem, to be written in C++. I've created a class diagram and sequence diagrams for the major use cases. I've also specified the public attributes, associations and methods for each of the classes. But, I haven't drilled the method definitions down to the C++ level yet. Since I'm new to C...