Hi,
In C++, what's the overhead (memory/cpu) associated with inheriting a base class that has no virtual functions? Is it as good as a straight up copy+paste of class members?
class a
{
public:
void get();
protected:
int _px;
}
class b : public a
{
}
compared with
class a
{
public:
void get();
protected:
int _px;
}...
Using Visual Studio 2008 and its C/C++ compiler, how do I create a Win32 DLL that is dependent only on other Windows DLLs, and has no dependency on the Microsoft C runtime?
I have some C code I want to place in a DLL that is entirely computation, and makes almost no use of C library functions.
For those it does use (eg memcpy), I'm hap...
(Win32 platform c++)
Using __try and __finally, how can I get the module name (And address) of the cause for an exception? I call GetExceptionInformation() but from that I am not sure where this information is.
Given other resources online and in MSDN the Minidump handlers and other sample code seem to be able to get it, but I am not...
I'm getting a lot of errors compiling code using the boost libraries, mainly when I'm using Spirit namespace. The errors are syntax errors on boost files like:
boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<'
or
boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: miss...
I'm trying to to program a serial communication using hardware handshake in linux using C/C++. The signals that implement the handshake are CTS (Clear to send) and RTS (Request to send). Currently my function for setting the CTS signal looks as follows:
int setCTS(int fd, int value) {
int status;
ioctl(fd, TIOCMGET, &status); //...
Here is the code for my head file...
#pragma once
#pragma unmanaged
__declspec(dllexport) public void CallMe(wchar_t *p);
Here is all the code SO FAR for my definition file...
LIBRARY "CppWrapper"
My "CallMe" function's name compiles to "?CallMe@@YAXPA_W@Z". What do I need to add/write in my .def file to correct the compiled name ...
Is there a non-hacky (i.e. no assembly, ...) way to use boost functions to create callbacks with non-static class methods?
Currently for static methods:
list<function<void (LuaState&)> > _callbacks;
I was thinking something along the lines of
list<tuple<function<void (void *, LuaState&)>, void*> _callbacks;
but boost functions doe...
I have a large solution that contains C# and C++ projects. After I code in my classes or functions I run a build to have the parser check syntax. What I have noticed is that when I press F6 the entire solution will build and get parsed except for the C++ files that I'm working on.
This seems like it's not the intended function of the ed...
Hi!
Can anyone pls tell me that, why I can't use normal C++ classes within a QT programme. If there is any class which aren't inherited from QObject the compiler give me a linking error called,
error LNK2019: unresolved external symbol _main referenced in function _WinMain@16
I'm using Qt4.5.2 (compiled by myself) with vs2005. Pls h...
That is, the computational complexity. Does it have to count all the elements? Does it depend on implementation? The SGI spec doesn't guarantee anything.
...
I'm having a problem getting forward declaration to work (actually I'm not sure if it should work the way I intend).
I have a cpp file as follows:
int DialogModeless::Create(int dialogID, Presenter* pPresenter)
{
Ptrs* pPtrs = new Ptrs;
pPtrs->pPresenter = pPresenter;
pPtrs->pWnd = _derived;
HINSTANCE hInstance = ::GetM...
Hello there
I am wondering if php methods are ever defined outside of the class body as they are often done in C++. I realise this question is the same as http://stackoverflow.com/questions/71478/defining-class-methods-in-php . But I believe his original question had 'declare' instead of 'define' so all the answers seem a bit inappropr...
The sequence of triangle numbers is
generated by adding the natural
numbers. So the 7th triangle number
would be 1 + 2 + 3 + 4 + 5 + 6 + 7 =
28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55,
...
Let us list the factors of the first
seven triangle numbers:
1: 1
3: 1,3
6: 1,2,3,6
10: 1,2,5,...
I have the following example, compiled in VS2005, warning level 4:
int main(int argc, char *argv[])
{
short s = 2;
short t = 3;
t *= s; // warning C4244: '*=' : conversion from 'int' to 'short', possible loss of data
t = t * s;
}
It doesn't seem to me there should be a warning on either line.
Does *= create an im...
UPDATE: Found a way to make it compile, see below.
Hello, I'm having issues compiling boost programs under cygwin. I've installed the default boost and g++ packages from the cygwin project's setup.exe.
On my Linux systems, I can compile a program reg.cpp using the following:
g++ -I/usr/include/boost -lboost_regex -o reg reg.cpp
On c...
I'm doing some linear algebra math, and was looking for some really lightweight and simple to use matrix class that could handle different dimensions: 2x2, 2x1, 3x1 and 1x2 basically.
I presume such class could be implemented with templates and using some specialization in some cases, for performance.
Anybody know of any simple implement...
I am running a system written in c++ that is continuously inserting large amounts of data into my database and at the same time querying the database for updated results. My problem is that the postgres threads started in this process continuously use more and more memory. I need to know how to correct this problem. The following is a mu...
So I'm writing a version of the game Hunt the Wumpus in C++. The only real difference is that I'm not worried about the cave having a dodecahedron shape.
So far I've implemented the creation of the cave and the random insertion of the hero, bat, wumpus, and pit.
// Hunt the Wumpus
#include "std_lib_facilities.h"
#include "time.h"
cla...
Hi,
Does anyone have any good source that I can read how to develop API for C++ or C#?
Thanks in advance.
...
Okay, Allow me to re-ask the question, as none of the answers got at what I was really interested in (apologies if whole-scale editing of the question like this is a faux-paus).
A few points:
This is offline analysis with a different compiler than the one I'm testing, so SIZEOF() or similar won't work for what I'm doing.
I know it's i...