I'm having trouble understanding how compilers and linkers work and the files they create. More specifically, how do .cpp, .h, .lib, .dll, .o, .exe all work together? I am mostly interested in C++, but was also wondering about Java and C#. Any books/links would be appreciated!
...
Possible Duplicates:
How does the standard new operator work in c++?
How does delete[] “know” the size of the operand array?
Dupe of http://stackoverflow.com/questions/197675/how-does-delete-know-the-size-of-the-operand-array
I am curious how delete[] figures out the size of the allocated memory. When I do something like:
in...
I have some ancient memories of writing C code like:
long value = 0;
in the bad old Win16 days and ending up with value being only half-initialized: i.e. the lower 16 bits were 0 and the upper 16 bits were whatever random bits were at that location in memory. As such, I became conditioned to write:
long value = 0L;
Is this still re...
I have a schema (xsd), and I want to create xml files that conform to it.
I've found code generators that generate classes which can be loaded from an xml file (CodeSynthesis). But I'm looking to go the other direction.
I want to generate code that will let me build an object which can easily be written out as an xml file. In C++. I...
Our Windows app is often hanging in memory and I'm trying to use windbg to track
down the problem. I'm very new to windbg and could use some advice (I
have started to read Advanced Windows Debugging though).
The app is a mix of C++ and COM objects written in VB. Occasionally when
you exit, the app appears to go away but task manager sho...
Here is an example to illustrate what I mean:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main(void)
{
int fd[2], nbytes;
pid_t childpid;
char string[] = "Hello, world!\n";
char readbuffer[80];
pipe(fd);
if((childpid = fork()) == -1)
{
...
Is it possible to use const parameter to CArray
I am currently using CArray like this but it won't compile:
typedef CArray<const CString, const CString&> data_container;
And I always get this compile error :
error C2664: 'ATL::Checked::memcpy_s'
: cannot convert parameter 1 from
'const CString *' to 'void *'
...
Hello
I want to be able to select which item is selected in another program's list view(I don't have access to its code). Actually, it is an SysListView32, which I assume is the same. I already have the following code, which unfortunely despite compiling, seems to do nothing (although SendMessage() returns 1).
process=OpenProcess(PROCE...
Is there some tool (hopefully emacs) that can update and add the correct function definitions and other things to keep the source (.cpp) and the header (.h) files synchronized.
For example if I start doing this
file: aaa.h
Class AAA {
int b;
public:
void func();
};
something that will automatically create and add
file: aaa.c...
I am ActionScript 3/Flex programmer, it is the first language I learned.
I want to learn either Java or C++.
Would one of these be easier to learn based on my current knowledge?
...
I'm stopping a service in my application wanted to know what is the usage of
ExitProcess and if I should use it
...
I am having a hard time getting this to work
file: myclass.hpp
Class MyClass {
public:
template <class T>
MyClass &operator<<(const T &val);
};
file: myclass.cpp
template <class T>
MyClass &MyClass::operator<<(const T &val) {
...
}
I can compile this in to a object without a problem, But when other functions try to ca...
I've seen quite a few recommendations for not seeding pseudo-random number generators more than once per execution, but never accompanied by a thorough explanation. Of course, it is easy to see why the following (C/C++) example is not a good idea:
int get_rand() {
srand(time(NULL));
return rand();
}
since calling get_rand several ...
I know Joel says to never do it, and I agree with this in most cases. I do think there are cases where it is justified.
We have a large C++ application (around 250,000 total lines of code) that uses a MFC front end and a Windows service as the core components. We are thinking about moving the project to C#.
The reasons we are thinking ...
I would like to have an easy to use way to write code like:
#include <iostream>
int main (){
std::cout << "hello, world!\n";
}
but that supports i18n. Here is an example using gettext():
#include <libintl.h>
#include <iostream>
int main (){
std::cout << gettext("hello, world!\n");
}
This can then be processed by xgettext to...
Hi,
I'm doing IPC on Linux using boost::interprocess::shared_memory_object as per the reference (anonymous mutex example).
There's a server process, which creates the shared_memory_object and writes to it, while holding an interprocess_mutex wrapped in a scoped_lock; and a client process which prints whatever the other one has written ...
I use C++/MFC programming for developing some very basic applications.
but I am looking for a C++ framework which can enhance my productivity as well as use the drag and drop feature(so that I can write programs like in .NET just drag controls and drop).
and give me the C++ speed and native .exe + small .exe.
can wxWidgets give me such ...
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast.
Anyways, could anyone elaborate on this? What exactly makes development in ...
In C++, it is legal to give an implementation of a pure virtual function:
class C
{
public:
virtual int f() = 0;
};
int C::f()
{
return 0;
}
Why would you ever want to do this?
Related question: The C++ faq lite contains an example:
class Funct {
public:
virtual int doit(int x) = 0;
virtual ~Funct() = 0;
};
inline Funct::...
The library I'm using has class G and class S which inherits G.
I needed to add functionality to them, so I wrapped G and S, rather I inherited from them making Gnew and Snew respectively.
So, my inheritance is:
G --> Gnew
|
v
S --> Snew
But, I want to use Gnew in Snew and when I try to include the Gnew header...