Hi all,
I've written a low lock list in C++ on windows 32-bit. I'm getting BIG improvements over using critical sections but I'd like someone to sanity check that what I'm doing is correct and there aren't any errors in what I've done:
#ifndef __LOW_LOCK_STACK_H_
#define __LOW_LOCK_STACK_H_
template< class T > class LowLockStack
{
pr...
Is it possible to have a vector as a global variable is C++?
Like this:
class system {...};
vector<system> systems;
when I try to compile this I get an error. The compiler I'm using is gcc and I'm compiling as C++.
...
Here's what I want to do:
Take 2x101 matrix for x and y coordinates and import that data in Dev C++ in program and use it for that code.
Right now my Dev code has
double Cord[NCargo][2] = {{x0,y0},{x1,y2},{...},{x100,y100}}
You get the idea. I want my .mat file matrix read into and put into this Cord Matrix. The name of my C+...
Perhaps my knowledge of inheritance and polymorphism isn't what I thought it was. Can anyone shed some light?
Setup (trivialization of problem):
class X {
};
class Y {
};
class Base {
public:
void f( X* ) {}
};
class Child: public Base {
public:
void f( Y* ) {}
};
Question: This should work, right?
int main( void ) {...
I want to be able to have a vector of vectors of some type such as:
vector<vector<MyStruct> > vecOfVec;
I then create a vector of MyStruct, and populate it.
vector<MyStruct> someStructs;
// Populate it with data
Then finally add someStructs to vecOfVec;
vecOfVec.push_back(someStructs);
What I want to do is avoid having the copy ...
Hi there,
we have a C++ class which basically reads and writes vectors from a binary file. An exemplary read function that loads a single vector into memory looks like this:
int load (const __int64 index, T* values) const {
int re = _fseeki64(_file, index * _vectorSize + _offsetData, SEEK_SET);
assert(re == 0);
size_t read = frea...
I am interested in allocating pointers, storing those in the LPARAM data of a comboboxex control, and making that control responsible for deleting those pointers when it is destroyed.
Since I am working in MFC, I can subclass a CComboBoxEx, and add either a message handler or a virtual member function.
The question is: Is this pattern ...
I am looking for a way to obfuscate (in the object code) a test - something like what might be done to check that a license key is valid. What I am trying to prevent is someone searching through an image binary for the code that processes the response.
bool checkError = foo();
if ( checkError ) // I'd like to avoid making a simple check...
Hi All,
I have installed VS2008 FeaturePack so as to work with regular expressions in C++. However when I execute the program i get the following error.
the procedure entry point ?_Xmem@tr1@std@@YAXXZ could not be located in the dynamic link library MSVCP90D.dll.
How could have gone wrong?
Thanks and Regards,
SS
...
Is there a particular reason when C / C++ were created that #elif was chosen over #elsif?
if ( ) {
} else if ( ) {
} else {
}
Fixed syntax
...
I have two packed quadword integers in xmm0 and I need to add them together and store the result in a memory location. I can guarantee that the value of the each integer is less than 2^15. Right now, I'm doing the following:
int temp;
....
movdq2q mm0, xmm0
psrldq xmm0, 8
movdq2q mm1, xmm0
paddq mm0,mm1
movd temp, mm0...
I have an ActiveX control written in C++ that I created with VS2008 and ATL. For the most part, it is a pretty standard (not modified much from the original template) control, except that instead of using IDispatchImpl, I have created my own IDispatchEx implementation. This control is only used in Internet Explorer, and I have been tes...
General question:
For unmanaged C++, what's better for internal code sharing?
Reuse code by sharing the actual source code? OR
Reuse code by sharing the library / dynamic library (+ all the header files)
Whichever it is: what's your strategy for reducing duplicate code (copy-paste syndrome), code bloat?
Specific example:
Here's ...
I have a native C++ application that, for the time being simply needs to send its command line string and current mouse cursor coordinates to a WPF application. The message is sent and received just fine, but I cannot convert the IntPtr instance in C# to a struct.
When I try to do so, the application will either crash without exception ...
Hi,
I'm using the unordered_map of TR1 implementation in my code and the linker gives weird errors I cannot even decipher:
BPCFG.o: In function `std::__detail::_Hash_code_base<DottedRule, std::pair<DottedRule const, int>, std::_Select1st<std::pair<DottedRule const, int> >, eqDottedRule, std::hash<DottedRule>, std::__detail::_Mod_rang...
I have this general problem in design, refactoring or "triage":
I have an existing multi-threaded C++ application which searches for data using a number of plugin libraries. With the current search interface, a given plugin receives a search string and a pointer to a QList object. Running on a different thread, the plugin goes out and s...
Is there library usable from c++ for sharing fairly simple data (integers,floating point numbers, strings) between cooperative processes?
Must be :
high-speed (SQL-based methods too slow due to parsing)
able to get,set,update,delete both fixed and variable data types (e.g. int and string)
ACID (atomic,consistent,isolated,durable)
us...
I would like to check if my application is being run on VMWare.
Is there a reliable way to do this in C++?
...
I am working on a project to display and animate a tree growing. I am using C++ and OpenGL on this project. The tree grows to a certain number of branches, stops, and then the tree's leaves fall to the ground. I have decided to use Lidenmayer systems to graphically depict this because it seemed an easier alternative to creating a structu...
The subject has it all. I want to have the Windows save as dialog as part of my own dialog. Is that even possible ?
...