I know that there are sections like Stack, Heap, Code and Data. Stack/Heap do they use the same section of memory as they can grow independently?
What is this code section? When I have a function is it a part of the stack or the code section?
Also what is this initialized/uninitialized data segment?
Are there read only memory section a...
I need to draw lines using DrawPrimitiveUP and I need it to use the color value from my defined structure.
Important snippets from the code:
struct PointVertexColor
{
float x, y, z; // Position
DWORD color; //Colour
};
#define D3DFVF_PointVertexColor ( D3DFVF_XYZ | D3DFVF_DIFFUSE )
PointVertexColor myLines[1024];
device->Draw...
I have a project where I need to reference a variable declared in one CPP file in another, is that possible?
If so, how?
...
My function:
/*
--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_
runPE(
dosheader ptr,
ntheader ptr,
sectionheader ptr,
ptr to exebuffer,
DWORD SizeOfImage(Alignment fixed))
_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--
*/
int runPE2(IMAGE_DOS_HEADER* pDOS,IMAGE_NT_HEADERS * pNT...
I'm learning about Thread Local Storage... (TLS)
Here is my TLS Alloc code:
//global variable
DWORD g_dwTlsIndex;
//inside DLLMain:
int val= 5;
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_dwTlsIndex = TlsAlloc();
if ((g_dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES)
{
printf("No more indexes available");
}
...
I have a dynamically created toolbar on a plain Win32 dialog. My buttons are added with & shortcuts which correctly puts underscore to characters following ampersand but pressing Alt+(char) causes a beep and the button is not clicked.
It has been a while since I have done Win32 API development. Is there something that needs to be done t...
In NetBeans 6.9 in windows version I use CygWin for C++ programming.I can compile my simple program and BUILD SUCCESSFUL message show by output window in NetBeans but when run my project this message show in external terminal :
/cygdrive/c/Users/SjB/Documents/NetBeansProjects/CppApplication_3/dist/Debug/Cyg
win-Windows/cppapplication_3....
Hello guys, I have some code which use 'this' pointer of class which calls this code. For example:
Some::staticFunction<templateType>(bind(FuncPointer, this, _1));
Here is I'm calling bind function from boost. But it doesn't matter. Now I have to wrap this code. I made a macro:
#define DO(Type, Func) Some::staticFunction<Type>(bind(F...
Hey,
Ever since I started playing games, I wanted to develop my own, simple and later more complex game. At the moment I earn my share with programming web applications and doing some simple game development in my free time.
As for my programming experience. I have good knowledge of almost anything web related (PHP, AJAX, JS, etc.). T...
I'm trying to write a simple C++ program to open a torrent file (Passed through argv[1]), read all of it, and then print the entire file's contents verbatim with no alterations, it has to print a carbon copy of the original torrent. The issue is, some of the torrents may contain Japanese, Russian, etc. (FIlenames, description, etc.)... A...
Hello, I have some templated function which has different number of arguments due to the template-type. This function is wrapped with macro definition.
#define SomeTemplate(TemplateType, Arguments) someFunc<TemplateType>(Arguments);
Everything is okay until I'm using only 1 argument for function calling. But I need in more. I looked a...
I need to read from a dataset which is very large, highly interlinked, the data is fairly localized, and reads are fairly expensive. Specifically:
The data sets are 2gigs - 30gigs in size, so I have to map sections of the file into memory to read. This is very expensive compared to the rest of the work I do in the algorithm. From pr...
I'm pondering a current limitation of STL iterators and wondering if there's an elegant way around it. Here's my situation: I have a class that encapsulates a sequence container and a generic method to mutate the contents of the container, for example:
class Container {
typedef std::vector<int> Data;
Data data_;
public:
template ...
Hi guys,
I'm using Qt 4.6 and I'd like to react to multi-key combos (e.g. Key_Q+Key_W) that are being held down. So when you hold down a key combo, the event should be called all the time, just the same way as it works with single key events. I tried to use QShortcuts and enable autorepeat for them, but that didn't work:
keyCombos_.pus...
I have this situation:
I have a class which keeps track of an array of pointers. I built a custom iterator which loops through this array.
My problem is on how to make it threadsafe, especially while incrementing/decrementing?
Here is a draft of the relevant parts of what I have:
typedef fruit * iterator;
class fruits
{
private:
...
Destructors aren't virtual by default to not hurt when its not needed, which is fine.
But in case of a base class derived class scenario, is there any use case for not having a virtual destructor? If not could it be possible (does it make sense) for the compiler to complain if a class derives from a base class which has a public non vir...
Hi folks,
I wanted to use DevC++ on Linux, so I've started it with wine and everything is OK until it came to run the file.
The C file compiles well and a .exe files generated that is able to run on Linux (without wine)
$ file '/media/F6AC746BAC74286F/Dev-Cpp/work/hello_on_nix.exe'
/media/F6AC746BAC74286F/Dev-Cpp/work/hello_on_nix.ex...
After exhaustive googling and visiting many forums, I am yet to find a good comprehensive answer for this question. A lot of the forums suggest using the get line
istream& getline (char* s, streamsize n ) function. My question is what if I don't know what the length of each line is and cannot predict what the size may be? Also what is i...
What does an r-value reference look like from a lower-level perspective. I just can't seem to wrap my head around it! Can I see an example of generated code (either equivalent C or x86/x64) from a r-value reference vs. a l-value reference?
For example, what would this construct look like? Let's assume no copy elision for now.
vector<So...
I use QTableView + QStandardItemModel to show some data (data stored in some other data structure), and this table view is sortable.
Since it is sortable, when sorting this model, I also need to sort the order of stored data. I try to implement a slot for the sorting signal, but I don't know what signal is emitted when clicking the head...